Skip to content

Commit

Permalink
Item13030: complete port to jsrender
Browse files Browse the repository at this point in the history
also:
- hide buttons on static context
- require JsonRpcContrib > 2.21
- updated translation strings
  • Loading branch information
MichaelDaum committed Feb 16, 2015
1 parent a644920 commit 381f12b
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 59 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
*~
*.gz
*.swp
pub/System/ListyPlugin/jquery.listy.js
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/ListyPlugin/Core.pm
Expand Up @@ -294,7 +294,7 @@ sub _expandButtons {

my $buttons = '';

if (Foswiki::Func::checkAccessPermission('CHANGE', $wikiName, undef, $topic, $web)) {
if (!Foswiki::Func::getContext()->{static} && Foswiki::Func::checkAccessPermission('CHANGE', $wikiName, undef, $topic, $web)) {
$buttons = Foswiki::Func::expandTemplate("listy::buttons");
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/ListyPlugin/DEPENDENCIES
@@ -1,6 +1,6 @@
Foswiki::Plugins::RenderPlugin,>=3.10,perl,Required.
Foswiki::Plugins::JQueryPlugin,>=6.00,perl,Required.
Foswiki::Contrib::JsonRpcContrib,>=1.0,perl,Required.
Foswiki::Contrib::JsonRpcContrib,>=2.21,perl,Required.
ONLYIF ( $Foswiki::Plugins::VERSION < 2.1)
Foswiki::Plugins::ZonePlugin,>=3.1,perl,Required. required for Foswiki < 1.1

86 changes: 65 additions & 21 deletions locale/ListyPlugin/Foswiki.pot
Expand Up @@ -13,74 +13,118 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: templates/listyplugin.tmpl:235 templates/listyplugin.tmpl:80
msgid ":collection"
msgstr ""

#: templates/listyplugin.tmpl:147 templates/listyplugin.tmpl:81
msgid ":name"
msgstr ""

#: templates/listyplugin.tmpl:146 templates/listyplugin.tmpl:82
msgid ":source"
msgstr ""

#: templates/listyplugin.tmpl:222
msgid ":summary"
msgstr ""

#: templates/listyplugin.tmpl:190 templates/listyplugin.tmpl:83
msgid ":title"
msgstr ""

#: templates/listyplugin.tmpl:206
msgid ":topic"
msgstr ""

#: templates/listyplugin.tmpl:145
msgid ":type"
msgstr ""

#: templates/listyplugin.tmpl:214
msgid ":url"
msgstr ""

#: templates/listyplugin.tmpl:202
msgid ":web"
msgstr ""

#: templates/listyplugin.tmpl:231
msgid ":~renderCollections()"
msgstr ""

#: templates/listyplugin.tmpl:53
msgid "Add Item"
msgstr ""

#: templates/listyplugin.tmpl:177
msgid "Add a description to this listy item."
#: templates/listyplugin.tmpl:223
msgid "Add a description for this item."
msgstr ""

#: templates/listyplugin.tmpl:88
#: templates/listyplugin.tmpl:99
msgid "Add an item"
msgstr ""

#: templates/listyplugin.tmpl:196
#: templates/listyplugin.tmpl:83
msgid "Are you sure that you want to delete %1?"
msgstr ""

#: templates/listyplugin.tmpl:185
msgid "Cancel"
#: templates/listyplugin.tmpl:230
msgid "Collection"
msgstr ""

#: templates/listyplugin.tmpl:148
msgid "Customize the text of your listy item."
#: templates/listyplugin.tmpl:191
msgid "Customize the text of your item."
msgstr ""

#: templates/listyplugin.tmpl:191
msgid "Delete Listy Item"
#: templates/listyplugin.tmpl:78
msgid "Delete Item"
msgstr ""

#: templates/listyplugin.tmpl:21
msgid "Delete this item"
msgstr ""

#: templates/listyplugin.tmpl:111 templates/listyplugin.tmpl:20
#: templates/listyplugin.tmpl:139 templates/listyplugin.tmpl:20
msgid "Edit this item"
msgstr ""

#: templates/listyplugin.tmpl:136
#: templates/listyplugin.tmpl:181
msgid "External"
msgstr ""

#: templates/listyplugin.tmpl:75
msgid "Revert changes"
msgstr ""

#: templates/listyplugin.tmpl:184
msgid "Save"
msgstr ""

#: templates/listyplugin.tmpl:64
msgid "Save changes"
msgstr ""

#: templates/listyplugin.tmpl:175
#: templates/listyplugin.tmpl:232
msgid "Select the collection to hold the item."
msgstr ""

#: templates/listyplugin.tmpl:221
msgid "Summary"
msgstr ""

#: templates/listyplugin.tmpl:146
#: templates/listyplugin.tmpl:171
msgid "Text"
msgstr ""

#: templates/listyplugin.tmpl:189
msgid "Title"
msgstr ""

#: templates/listyplugin.tmpl:133 templates/listyplugin.tmpl:159
#: templates/listyplugin.tmpl:176 templates/listyplugin.tmpl:205
msgid "Topic"
msgstr ""

#: templates/listyplugin.tmpl:167
#: templates/listyplugin.tmpl:213
msgid "Url"
msgstr ""

#: templates/listyplugin.tmpl:155
#: templates/listyplugin.tmpl:201
msgid "Web"
msgstr ""
97 changes: 76 additions & 21 deletions locale/ListyPlugin/de.po
Expand Up @@ -13,74 +13,129 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: templates/listyplugin.tmpl:235 templates/listyplugin.tmpl:80
msgid ":collection"
msgstr ""

#: templates/listyplugin.tmpl:147 templates/listyplugin.tmpl:81
msgid ":name"
msgstr ""

#: templates/listyplugin.tmpl:146 templates/listyplugin.tmpl:82
msgid ":source"
msgstr ""

#: templates/listyplugin.tmpl:222
#, fuzzy
msgid ":summary"
msgstr "Zusammenfassung"

#: templates/listyplugin.tmpl:190 templates/listyplugin.tmpl:83
#, fuzzy
msgid ":title"
msgstr "Titel"

#: templates/listyplugin.tmpl:206
#, fuzzy
msgid ":topic"
msgstr "Topic"

#: templates/listyplugin.tmpl:145
msgid ":type"
msgstr ""

#: templates/listyplugin.tmpl:214
msgid ":url"
msgstr ""

#: templates/listyplugin.tmpl:202
msgid ":web"
msgstr ""

#: templates/listyplugin.tmpl:231
msgid ":~renderCollections()"
msgstr ""

#: templates/listyplugin.tmpl:53
msgid "Add Item"
msgstr "Neuer Eintrag"

#: templates/listyplugin.tmpl:177
msgid "Add a description to this listy item."
#: templates/listyplugin.tmpl:223
#, fuzzy
msgid "Add a description for this item."
msgstr "Geben Sie eine Beschreibung für diesen Eintrag an."

#: templates/listyplugin.tmpl:88
#: templates/listyplugin.tmpl:99
msgid "Add an item"
msgstr "Eintrag hinzufügen"

#: templates/listyplugin.tmpl:196
#: templates/listyplugin.tmpl:83
msgid "Are you sure that you want to delete %1?"
msgstr "Sind Sie sicher, dass Sie diesen Eintrag löschen wollen? %BR% %2"

#: templates/listyplugin.tmpl:185
msgid "Cancel"
msgstr "Abbrechen"
#: templates/listyplugin.tmpl:230
msgid "Collection"
msgstr ""

#: templates/listyplugin.tmpl:148
msgid "Customize the text of your listy item."
#: templates/listyplugin.tmpl:191
#, fuzzy
msgid "Customize the text of your item."
msgstr "Passen Sie den Text dieses Eintrags an."

#: templates/listyplugin.tmpl:191
#: templates/listyplugin.tmpl:78
msgid "Delete Item"
msgstr "Eintrag löschen"

#: templates/listyplugin.tmpl:21
msgid "Delete this item"
msgstr "Diesen Eintrag löschen"

#: templates/listyplugin.tmpl:111 templates/listyplugin.tmpl:20
#: templates/listyplugin.tmpl:139 templates/listyplugin.tmpl:20
msgid "Edit this item"
msgstr "Eintrag bearbeiten"

#: templates/listyplugin.tmpl:136
#: templates/listyplugin.tmpl:181
msgid "External"
msgstr "Extern"

#: templates/listyplugin.tmpl:75
msgid "Revert changes"
msgstr "Rückgängig"

#: templates/listyplugin.tmpl:184
msgid "Save"
msgstr "Speichern"

#: templates/listyplugin.tmpl:64
msgid "Save changes"
msgstr "Speichern"

#: templates/listyplugin.tmpl:175
#: templates/listyplugin.tmpl:232
msgid "Select the collection to hold the item."
msgstr ""

#: templates/listyplugin.tmpl:221
msgid "Summary"
msgstr "Zusammenfassung"

#: templates/listyplugin.tmpl:146
#: templates/listyplugin.tmpl:171
msgid "Text"
msgstr ""

#: templates/listyplugin.tmpl:189
msgid "Title"
msgstr "Titel"

#: templates/listyplugin.tmpl:133 templates/listyplugin.tmpl:159
#: templates/listyplugin.tmpl:176 templates/listyplugin.tmpl:205
msgid "Topic"
msgstr "Topic"

#: templates/listyplugin.tmpl:167
#: templates/listyplugin.tmpl:213
msgid "Url"
msgstr "Url"

#: templates/listyplugin.tmpl:155
#: templates/listyplugin.tmpl:201
msgid "Web"
msgstr "Web"

#~ msgid "Cancel"
#~ msgstr "Abbrechen"

#~ msgid "Save"
#~ msgstr "Speichern"
30 changes: 16 additions & 14 deletions pub/System/ListyPlugin/jquery.listy.uncompressed.js
Expand Up @@ -272,9 +272,6 @@
data: {
collection: self.opts.collection,
allCollections: self.opts.allCollections,
renderCollections: function() {
return self.renderCollections();
},
name: name,
source: self.opts.source,
summary: decodeURIComponent(data.summary),
Expand All @@ -283,14 +280,18 @@
topic: data.topic,
url: data.url,
type: data.type
},
methods: {
renderCollections: function() {
return self.renderCollections();
},
}

}).then(
function(dialog) {
$(dialog).children("form").ajaxSubmit({
success: function(data) {
var json = $.parseJSON(data),
collection = json.result.collection,
success: function(json) {
var collection = json.result.collection,
listies = findListiesOfCollection(collection);

if (listies) {
Expand Down Expand Up @@ -327,23 +328,24 @@
data: {
collection: self.opts.collection,
allCollections: self.opts.allCollections,
renderCollections: function() {
return self.renderCollections();
},
source: self.opts.source,
summary: "",
title: "",
web: foswiki.getPreference("WEB"),
topic: foswiki.getPreference("TOPIC"),
url: ""
},
methods: {
renderCollections: function() {
return self.renderCollections();
},
}

}).then(
function(dialog) {
$(dialog).children("form").ajaxSubmit({
success: function(data) {
var json = $.parseJSON(data),
collection = json.result.collection,
success: function(json) {
var collection = json.result.collection,
listies = findListiesOfCollection(collection);

if (listies) {
Expand Down Expand Up @@ -613,7 +615,7 @@
},
open: function() {},
data: {
/* default variables to be used in jquery.tmpl */
/* default variables to be used in jquery.render */
/*
web: self.opts.web,
topic: self.opts.topic,*/
Expand Down Expand Up @@ -646,7 +648,7 @@
$.loadTemplate({
url: opts.url
}).then(function(template) {
$(template.render(opts.data)).dialog({
$(template.render(opts.data, opts.methods)).dialog({
buttons: [{
text: opts.okayText,
icons: {
Expand Down

0 comments on commit 381f12b

Please sign in to comment.