adva 0.1.4 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/adva.gemspec +3 -0
- data/app/assets/config/manifest.js +6 -0
- data/app/assets/javascripts/adva_cms/ckeditor.js.erb +12 -0
- data/app/assets/javascripts/adva_cms/concat_main_menus.js +13 -0
- data/app/assets/javascripts/adva_cms/jquery.table_tree.js +704 -0
- data/app/assets/javascripts/adva_cms.js +7 -0
- data/app/assets/javascripts/ckeditor/config.js.erb +94 -0
- data/app/assets/stylesheets/adva_cms/admin/common.scss +15 -1
- data/app/assets/stylesheets/adva_cms/admin/projection.scss +2 -5
- data/app/assets/stylesheets/adva_cms/admin/sidebar.scss +30 -9
- data/app/assets/stylesheets/adva_cms/admin.scss +1 -1
- data/app/controllers/admin/base_controller.rb +10 -24
- data/app/controllers/admin/page/articles_controller.rb +8 -27
- data/app/controllers/admin/page/categories_controller.rb +6 -9
- data/app/controllers/admin/page/links_controller.rb +6 -9
- data/app/controllers/admin/sections_controller.rb +7 -9
- data/app/controllers/admin/sites_controller.rb +9 -12
- data/app/controllers/admin/users_controller.rb +6 -9
- data/app/controllers/articles_controller.rb +30 -57
- data/app/controllers/base_controller.rb +8 -8
- data/app/controllers/password_controller.rb +3 -5
- data/app/controllers/session_controller.rb +3 -5
- data/app/helpers/activities_helper.rb +9 -20
- data/app/helpers/admin/base_helper.rb +4 -22
- data/app/helpers/base_helper.rb +1 -1
- data/app/helpers/content_helper.rb +7 -5
- data/app/helpers/resource_helper.rb +4 -5
- data/app/helpers/users_helper.rb +1 -1
- data/app/models/activity.rb +3 -0
- data/app/models/article.rb +0 -11
- data/app/models/category.rb +3 -3
- data/app/models/content.rb +10 -39
- data/app/models/link.rb +0 -1
- data/app/models/password_mailer.rb +6 -9
- data/app/models/section.rb +6 -7
- data/app/models/site.rb +0 -2
- data/app/models/user.rb +1 -2
- data/app/views/activity_notifier/new_content_notification.html.erb +5 -5
- data/app/views/admin/activities/_activities.html.erb +4 -4
- data/app/views/admin/activities/_comment.html.erb +21 -21
- data/app/views/admin/activities/_content.html.erb +4 -3
- data/app/views/admin/activities/_topic.html.erb +5 -5
- data/app/views/admin/install/confirmation.html.erb +3 -3
- data/app/views/admin/install/index.html.erb +14 -14
- data/app/views/admin/page/articles/_form.html.erb +28 -25
- data/app/views/admin/page/articles/_options.html.erb +3 -4
- data/app/views/admin/page/articles/edit.html.erb +3 -3
- data/app/views/admin/page/articles/new.html.erb +4 -4
- data/app/views/admin/page/categories/edit.html.erb +9 -9
- data/app/views/admin/page/categories/index.html.erb +16 -16
- data/app/views/admin/page/categories/new.html.erb +5 -3
- data/app/views/admin/page/contents/index.html.erb +3 -18
- data/app/views/admin/page/links/_form.html.erb +17 -17
- data/app/views/admin/page/links/_options.html.erb +16 -19
- data/app/views/admin/page/links/edit.html.erb +3 -3
- data/app/views/admin/page/links/new.html.erb +3 -3
- data/app/views/admin/sections/_form.html.haml +5 -5
- data/app/views/admin/sections/edit.html.haml +2 -2
- data/app/views/admin/sections/index.html.erb +18 -18
- data/app/views/admin/sections/new.html.erb +15 -13
- data/app/views/admin/sections/settings/_page.html.haml +4 -6
- data/app/views/admin/shared/_header.html.erb +5 -4
- data/app/views/admin/shared/_section_tree.html.erb +2 -2
- data/app/views/admin/sites/_email_notifications.html.erb +6 -7
- data/app/views/admin/sites/_form.html.erb +7 -7
- data/app/views/admin/sites/_recent_users.html.erb +4 -2
- data/app/views/admin/sites/_unapproved_comments.html.erb +1 -1
- data/app/views/admin/sites/index.html.erb +1 -1
- data/app/views/admin/sites/new.html.erb +2 -2
- data/app/views/admin/sites/show.html.erb +7 -8
- data/app/views/admin/users/edit.html.erb +1 -1
- data/app/views/admin/users/index.html.erb +10 -10
- data/app/views/admin/users/new.html.erb +1 -1
- data/app/views/admin/users/show.html.erb +7 -7
- data/app/views/layouts/admin.html.haml +3 -5
- data/app/views/layouts/login.html.erb +1 -1
- data/app/views/password/edit.html.erb +12 -5
- data/app/views/password/new.html.erb +7 -7
- data/app/views/password_mailer/reset_password_email.html.erb +21 -1
- data/app/views/password_mailer/updated_password_email.html.erb +3 -1
- data/app/views/session/new.html.erb +9 -9
- data/app/views/shared/_flash.html.erb +2 -2
- data/app/views/shared/_sidebar.html.erb +2 -2
- data/config/initializers/ckeditor.rb +61 -0
- data/config/initializers/time_format.rb +2 -0
- data/lib/adva/authenticate_user.rb +193 -0
- data/lib/{active_record → adva}/belongs_to_author.rb +4 -4
- data/lib/adva/event.rb +34 -0
- data/lib/adva/extensible_forms.rb +285 -0
- data/lib/{has_options.rb → adva/has_options.rb} +5 -7
- data/lib/adva/has_permalink.rb +36 -0
- data/lib/adva/version.rb +1 -1
- data/lib/adva.rb +10 -36
- data/lib/rails_ext/action_controller/event_helper.rb +1 -1
- data/lib/rails_ext.rb +0 -9
- data/vendor/gems/cacheable_flash/.gitignore +8 -0
- data/vendor/gems/cacheable_flash/Gemfile +8 -0
- data/vendor/gems/cacheable_flash/README.md +35 -0
- data/vendor/gems/cacheable_flash/Rakefile +4 -0
- data/vendor/gems/cacheable_flash/bin/console +15 -0
- data/vendor/gems/cacheable_flash/bin/setup +8 -0
- data/vendor/gems/cacheable_flash/cacheable_flash.gemspec +38 -0
- data/vendor/gems/cacheable_flash/lib/cacheable_flash/controller.rb +29 -0
- data/vendor/gems/cacheable_flash/lib/cacheable_flash/javascript.js +19 -0
- data/vendor/gems/cacheable_flash/lib/cacheable_flash/middleware.rb +30 -0
- data/vendor/gems/cacheable_flash/lib/cacheable_flash/version.rb +5 -0
- data/vendor/gems/cacheable_flash/lib/cacheable_flash.rb +12 -0
- data/vendor/gems/simple_taggable/lib/tag_list.rb +1 -1
- data/vendor/gems/tags/lib/menu.rb +1 -1
- data/vendor/gems/tags/lib/tags/tag.rb +1 -1
- metadata +71 -144
- data/app/assets/javascripts/adva_cms/admin/jquery.admin.js +0 -23
- data/app/assets/javascripts/adva_cms/admin/jquery.article.js +0 -22
- data/app/assets/javascripts/adva_cms/admin/jquery.cached_pages.js +0 -14
- data/app/assets/javascripts/adva_cms/admin/jquery.table_tree.js +0 -7
- data/app/assets/javascripts/adva_cms/application.js +0 -13
- data/app/assets/javascripts/adva_cms/base.js +0 -4
- data/app/assets/javascripts/adva_cms/cookie.js +0 -49
- data/app/assets/javascripts/adva_cms/jquery/jquery-lowpro.js +0 -224
- data/app/assets/javascripts/adva_cms/jquery/jquery.qtip.js +0 -2085
- data/app/assets/javascripts/adva_cms/jquery/jquery.table_tree.js +0 -307
- data/app/assets/javascripts/adva_cms/jquery/jquery.tablednd_0_5.js +0 -386
- data/app/assets/javascripts/adva_cms/jquery.common.js +0 -41
- data/app/assets/javascripts/adva_cms/jquery.dates.js +0 -51
- data/app/assets/javascripts/adva_cms/jquery.flash.js +0 -59
- data/app/assets/javascripts/adva_cms/jquery.roles.js +0 -25
- data/app/assets/javascripts/adva_cms/json.js +0 -139
- data/app/controllers/admin/base_account_controller.rb +0 -13
- data/app/controllers/admin/install_controller.rb +0 -61
- data/app/controllers/admin/plugins_controller.rb +0 -38
- data/app/helpers/meta_tags_helper.rb +0 -30
- data/app/models/account.rb +0 -7
- data/app/models/event.rb +0 -34
- data/app/views/admin/articles/_meta_tags.html.erb +0 -7
- data/app/views/admin/cached_pages/_filter.html.erb +0 -8
- data/app/views/admin/cached_pages/destroy.js.erb +0 -18
- data/app/views/admin/cached_pages/index.html.erb +0 -26
- data/app/views/admin/plugins/_form.html.erb +0 -11
- data/app/views/admin/plugins/index.html.erb +0 -16
- data/app/views/admin/plugins/show.html.erb +0 -43
- data/app/views/admin/shared/_language_select.html.erb +0 -6
- data/app/views/admin/shared/_section_summary.html.erb +0 -23
- data/app/views/admin/sites/_meta_tags.html.erb +0 -15
- data/app/views/layouts/default.html.erb +0 -38
- data/app/views/layouts/simple.html.erb +0 -22
- data/app/views/shared/_footer.html.erb +0 -4
- data/app/views/shared/messages/insufficient_permissions.html.erb +0 -4
- data/config/initializers/article.rb +0 -8
- data/config/initializers/has_options.rb +0 -2
- data/config/initializers/has_permalink.rb +0 -2
- data/config/initializers/site.rb +0 -8
- data/config/locales/en.yml +0 -1319
- data/lib/action_controller/authenticate_anonymous.rb +0 -69
- data/lib/action_controller/authenticate_user.rb +0 -203
- data/lib/core_ext.rb +0 -7
- data/lib/extensible_forms.rb +0 -284
- data/lib/has_permalink.rb +0 -33
- data/lib/login/helper_integration.rb +0 -11
- data/lib/login/mail_config.rb +0 -39
- data/lib/rails_ext/action_controller/cacheable_flash.rb +0 -30
- data/lib/rails_ext/action_controller/content_for_assignments.rb +0 -106
- data/lib/rails_ext/action_controller/page_caching.rb +0 -23
- data/lib/rails_ext/action_controller/responds_to_parent.rb +0 -46
- data/lib/rails_ext/active_record/exists.rb +0 -5
- data/lib/rails_ext/active_record/sti_instantiation.rb +0 -35
- data/lib/rails_ext/active_record/sticky_changes.rb +0 -30
- data/lib/rails_ext/railties/plugin.rb +0 -58
- data/lib/rails_ext/railties/plugin_configuration.rb +0 -72
- data/lib/registry.rb +0 -49
- data/lib/tasks/translation.rake +0 -69
- data/lib/time_hacks.rb +0 -57
- data/lib/webrat_patch.rb +0 -11
- data/test/meta_tags_test.rb +0 -42
- data/vendor/gems/has_counter/.gitignore +0 -17
- data/vendor/gems/has_counter/Gemfile +0 -4
- data/vendor/gems/has_counter/LICENSE +0 -22
- data/vendor/gems/has_counter/MIT-LICENSE +0 -20
- data/vendor/gems/has_counter/README.markdown +0 -64
- data/vendor/gems/has_counter/README.md +0 -29
- data/vendor/gems/has_counter/Rakefile +0 -2
- data/vendor/gems/has_counter/db/migrate/20080601194338_create_counters_table.rb.rb +0 -13
- data/vendor/gems/has_counter/has_counter.gemspec +0 -17
- data/vendor/gems/has_counter/lib/active_record/has_counter.rb +0 -67
- data/vendor/gems/has_counter/lib/counter.rb +0 -23
- data/vendor/gems/has_counter/lib/has_counter/version.rb +0 -3
- data/vendor/gems/has_counter/lib/has_counter.rb +0 -4
- data/vendor/gems/has_counter/spec/has_counter.sqlite3.db +0 -0
- data/vendor/gems/has_counter/spec/has_counter_spec.rb +0 -55
- data/vendor/gems/has_counter/spec/spec_helper.rb +0 -117
- data/vendor/gems/has_filter/.gitignore +0 -17
- data/vendor/gems/has_filter/Gemfile +0 -4
- data/vendor/gems/has_filter/LICENSE +0 -22
- data/vendor/gems/has_filter/README.md +0 -29
- data/vendor/gems/has_filter/Rakefile +0 -2
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_add.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_left.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_button_right.png +0 -0
- data/vendor/gems/has_filter/app/assets/images/has_filter/filter_remove.png +0 -0
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/filter.js +0 -35
- data/vendor/gems/has_filter/app/assets/javascripts/has_filter/jquery.filter.js +0 -23
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/alternate/filter.scss +0 -102
- data/vendor/gems/has_filter/app/assets/stylesheets/has_filter/filter.scss +0 -100
- data/vendor/gems/has_filter/app/helpers/filter_helper.rb +0 -3
- data/vendor/gems/has_filter/has_filter.gemspec +0 -17
- data/vendor/gems/has_filter/init.rb +0 -3
- data/vendor/gems/has_filter/lib/has_filter/active_record/act_macro.rb +0 -102
- data/vendor/gems/has_filter/lib/has_filter/filter/base.rb +0 -67
- data/vendor/gems/has_filter/lib/has_filter/filter/categorized.rb +0 -24
- data/vendor/gems/has_filter/lib/has_filter/filter/chain.rb +0 -45
- data/vendor/gems/has_filter/lib/has_filter/filter/set.rb +0 -80
- data/vendor/gems/has_filter/lib/has_filter/filter/state.rb +0 -25
- data/vendor/gems/has_filter/lib/has_filter/filter/tagged.rb +0 -22
- data/vendor/gems/has_filter/lib/has_filter/filter/text.rb +0 -55
- data/vendor/gems/has_filter/lib/has_filter/filter.rb +0 -17
- data/vendor/gems/has_filter/lib/has_filter/version.rb +0 -3
- data/vendor/gems/has_filter/lib/has_filter.rb +0 -22
- data/vendor/gems/has_filter/test/db/setup.rb +0 -45
- data/vendor/gems/has_filter/test/db/test.sqlite3.db +0 -0
- data/vendor/gems/has_filter/test/fixtures.rb +0 -15
- data/vendor/gems/has_filter/test/has_filter/filter_chain_test.rb +0 -41
- data/vendor/gems/has_filter/test/has_filter/filter_scopes_test.rb +0 -102
- data/vendor/gems/has_filter/test/has_filter/filter_tags_test.rb +0 -113
- data/vendor/gems/has_filter/test/has_filter/integration.rb +0 -15
- data/vendor/gems/has_filter/test/has_filter/scopes_test.rb +0 -48
- data/vendor/gems/has_filter/test/log/test.log +0 -34346
- data/vendor/gems/has_filter/test/models.rb +0 -23
- data/vendor/gems/has_filter/test/templates/has_filter/test/index.html.erb +0 -5
- data/vendor/gems/has_filter/test/test_helper.rb +0 -66
- data/vendor/gems/xss_terminate/.gitignore +0 -17
- data/vendor/gems/xss_terminate/Gemfile +0 -4
- data/vendor/gems/xss_terminate/LICENSE +0 -22
- data/vendor/gems/xss_terminate/MIT-LICENSE +0 -20
- data/vendor/gems/xss_terminate/README +0 -94
- data/vendor/gems/xss_terminate/README.md +0 -29
- data/vendor/gems/xss_terminate/Rakefile +0 -23
- data/vendor/gems/xss_terminate/lib/html5lib_sanitize.rb +0 -2453
- data/vendor/gems/xss_terminate/lib/rails_sanitize.rb +0 -8
- data/vendor/gems/xss_terminate/lib/xss_terminate/version.rb +0 -3
- data/vendor/gems/xss_terminate/lib/xss_terminate.rb +0 -141
- data/vendor/gems/xss_terminate/tasks/xss_terminate_tasks.rake +0 -7
- data/vendor/gems/xss_terminate/test/models/comment.rb +0 -5
- data/vendor/gems/xss_terminate/test/models/entry.rb +0 -7
- data/vendor/gems/xss_terminate/test/models/message.rb +0 -3
- data/vendor/gems/xss_terminate/test/models/person.rb +0 -5
- data/vendor/gems/xss_terminate/test/models/review.rb +0 -5
- data/vendor/gems/xss_terminate/test/schema.rb +0 -34
- data/vendor/gems/xss_terminate/test/setup_test.rb +0 -16
- data/vendor/gems/xss_terminate/test/xss_terminate_test.rb +0 -50
- data/vendor/gems/xss_terminate/xss_terminate.gemspec +0 -17
- /data/lib/tasks/{adva_cms.rake → adva.rake} +0 -0
@@ -1,41 +0,0 @@
|
|
1
|
-
(function($) {
|
2
|
-
window.Form = {
|
3
|
-
toggleDraft: function() {
|
4
|
-
if($(this).attr('checked')) {
|
5
|
-
$('#publish_date_wrapper').hide();
|
6
|
-
} else {
|
7
|
-
$('#publish_date_wrapper').show();
|
8
|
-
}
|
9
|
-
}
|
10
|
-
}
|
11
|
-
|
12
|
-
$(document).ready(function() {
|
13
|
-
$('#toggle_draft').click(Form.toggleDraft);
|
14
|
-
|
15
|
-
if($(".hint").size() > 0) {
|
16
|
-
$(".hint").each(function() {
|
17
|
-
if(!$(this).hasClass('text_only')) {
|
18
|
-
var label = $("label[for=" + this.getAttribute('for') + "]");
|
19
|
-
|
20
|
-
if(label) {
|
21
|
-
$(this).appendTo(label);
|
22
|
-
$(this).addClass("move_up");
|
23
|
-
}
|
24
|
-
|
25
|
-
$(this).addClass("enabled");
|
26
|
-
}
|
27
|
-
})
|
28
|
-
$('.hint.enabled').each(function() {
|
29
|
-
$(this).qtip({
|
30
|
-
content: $(this).html(),
|
31
|
-
position: { corner: { target: 'topMiddle', tooltip: 'bottomMiddle' }, adjust: { screen: true, scroll: true } },
|
32
|
-
// FIXME tip option for qtip is broken currently on firefox, add this when this is fixed: tip: 'bottomMiddle'
|
33
|
-
style: { background: '#FBF7E4', color: '#black', name: 'cream',
|
34
|
-
border: { width: 3, radius: 5, color: '#DDDDDD' } },
|
35
|
-
show: { delay: 0, when: { event: 'click' } },
|
36
|
-
hide: { when: { event: 'unfocus' }, effect: { length: 1000 } }
|
37
|
-
});
|
38
|
-
});
|
39
|
-
}
|
40
|
-
});
|
41
|
-
})(jQuery);
|
@@ -1,51 +0,0 @@
|
|
1
|
-
/* Date functions */
|
2
|
-
Date.UTCNow = function() {
|
3
|
-
d = new Date();
|
4
|
-
utc = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()));
|
5
|
-
// we need to correct the timezone offset because JS sucks really bad with timezones ...
|
6
|
-
return new Date(utc.getTime() + utc.getTimezoneOffset()*60000);
|
7
|
-
}
|
8
|
-
|
9
|
-
// parse an ISO8601 UTC date string (YYYY-mm-ddZHH:MM:SSZ)
|
10
|
-
Date.parseISO8601 = function(iso8601_date) {
|
11
|
-
return new Date(Date.parse(iso8601_date.replace(/-/g, '/').replace('T', ' ').substr(0, 19))); // always has exactly 19 chars
|
12
|
-
}
|
13
|
-
|
14
|
-
distanceOfTimeInWords = function(seconds) {
|
15
|
-
d = seconds/60; // in minutes
|
16
|
-
|
17
|
-
if (d < 1) return 'less than a minute';
|
18
|
-
|
19
|
-
d = Math.ceil(d); // if it's more than a minute, ceil it
|
20
|
-
if (d < 50) return (d + ' minute' + (d == 1 ? '' : 's'));
|
21
|
-
if (d < 90) return 'about one hour';
|
22
|
-
if (d < 1080) return (Math.round(d/60) + ' hours');
|
23
|
-
if (d < 1440) return 'one day';
|
24
|
-
if (d < 2880) return 'about one day';
|
25
|
-
else return (Math.round(d/1440) + ' days');
|
26
|
-
}
|
27
|
-
|
28
|
-
timeAgoInWords = function(iso8601_date) {
|
29
|
-
utc_date = Date.parseISO8601(iso8601_date);
|
30
|
-
utc_now = Date.UTCNow();
|
31
|
-
d = (utc_now.getTime() - utc_date.getTime())/1000; // in seconds
|
32
|
-
if (d > 0) {
|
33
|
-
return distanceOfTimeInWords(d) + ' ago';
|
34
|
-
} else {
|
35
|
-
return 'in '+ distanceOfTimeInWords(-d);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
createAndFormatDateSpan = function(abbr) {
|
40
|
-
// create a new span element and set its title to the abbr's innerHTML and its value to the timeAgoInWords string
|
41
|
-
abbr.html('<span title="' + abbr.html() + '">' + timeAgoInWords(abbr.attr('title')) + '</span>'); // only used for past dates right now so we can safely use time_ago_in_words here
|
42
|
-
}
|
43
|
-
|
44
|
-
(function($) {
|
45
|
-
$(document).ready(function() {
|
46
|
-
// parse all microformatted dates and re-format them as time distance
|
47
|
-
$('abbr.datetime').each(function() {
|
48
|
-
createAndFormatDateSpan($(this));
|
49
|
-
});
|
50
|
-
});
|
51
|
-
})(jQuery);
|
@@ -1,59 +0,0 @@
|
|
1
|
-
(function($) {
|
2
|
-
var Flash = function(root) {
|
3
|
-
return $.extend({}, Flash, { $root: $(root) });
|
4
|
-
};
|
5
|
-
|
6
|
-
Flash = $.extend(Flash, {
|
7
|
-
transferFromCookies: function() {
|
8
|
-
var data = JSON.parse(unescape(Cookie.get('flash')).replace(/\+/g, ' '));
|
9
|
-
if(!data) data = {};
|
10
|
-
this.data = data;
|
11
|
-
Cookie.erase('flash');
|
12
|
-
},
|
13
|
-
show: function(type, message) {
|
14
|
-
if(!this.data || this.data == {}) this.transferFromCookies();
|
15
|
-
|
16
|
-
var flash = this.$root.find('#flash_' + type);
|
17
|
-
// if no message is given, look it up in the hash
|
18
|
-
if(!message) message = this.data[type];
|
19
|
-
|
20
|
-
if(!message && type == 'error') message = this.data['alert'];
|
21
|
-
|
22
|
-
if(!message) return;
|
23
|
-
|
24
|
-
if(message.toString().match(/<li/)) message = "<ul>" + message + '</ul>'
|
25
|
-
flash.html(message);
|
26
|
-
|
27
|
-
flash.show();
|
28
|
-
},
|
29
|
-
|
30
|
-
showAll: function() {
|
31
|
-
this.show('error');
|
32
|
-
this.show('notice');
|
33
|
-
},
|
34
|
-
|
35
|
-
error: function(message) {
|
36
|
-
this.show('error', message);
|
37
|
-
},
|
38
|
-
|
39
|
-
notice: function(message) {
|
40
|
-
this.show('notice', message);
|
41
|
-
},
|
42
|
-
|
43
|
-
hide: function(type) {
|
44
|
-
this.$root.find('#flash_' + type).empty().hide();
|
45
|
-
},
|
46
|
-
|
47
|
-
hideAll: function() {
|
48
|
-
this.hide('error');
|
49
|
-
this.hide('notice');
|
50
|
-
}
|
51
|
-
});
|
52
|
-
|
53
|
-
$(document).ready(function() {
|
54
|
-
Flash.$root = $("body");
|
55
|
-
Flash.showAll();
|
56
|
-
});
|
57
|
-
|
58
|
-
window.Flash = Flash;
|
59
|
-
})(jQuery);
|
@@ -1,25 +0,0 @@
|
|
1
|
-
(function($) {
|
2
|
-
authorize_elements = function(roles) {
|
3
|
-
if($.inArray('superuser', roles) > -1) {
|
4
|
-
var elements = $('.visible_for');
|
5
|
-
} else {
|
6
|
-
var elements = [];
|
7
|
-
$.each(roles, function() {
|
8
|
-
$.each($('.' + this.toString()), function() {
|
9
|
-
elements.push(this);
|
10
|
-
});
|
11
|
-
});
|
12
|
-
}
|
13
|
-
|
14
|
-
$.each(elements, function() {
|
15
|
-
element = $(this);
|
16
|
-
if(element) {
|
17
|
-
element.removeClass('visible_for');
|
18
|
-
}
|
19
|
-
})
|
20
|
-
}
|
21
|
-
|
22
|
-
$(document).ready(function() {
|
23
|
-
authorize_elements(['anonymous']);
|
24
|
-
});
|
25
|
-
})(jQuery);
|
@@ -1,139 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2005 JSON.org
|
3
|
-
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
of this software and associated documentation files (the "Software"), to deal
|
6
|
-
in the Software without restriction, including without limitation the rights
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the Software is
|
9
|
-
furnished to do so, subject to the following conditions:
|
10
|
-
|
11
|
-
The Software shall be used for Good, not Evil.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
SOFTWARE.
|
20
|
-
*/
|
21
|
-
|
22
|
-
/*
|
23
|
-
The global object JSON contains two methods.
|
24
|
-
|
25
|
-
JSON.stringify(value) takes a JavaScript value and produces a JSON text.
|
26
|
-
The value must not be cyclical.
|
27
|
-
|
28
|
-
JSON.parse(text) takes a JSON text and produces a JavaScript value. It will
|
29
|
-
return false if there is an error.
|
30
|
-
*/
|
31
|
-
var JSON = function () {
|
32
|
-
var m = {
|
33
|
-
'\b': '\\b',
|
34
|
-
'\t': '\\t',
|
35
|
-
'\n': '\\n',
|
36
|
-
'\f': '\\f',
|
37
|
-
'\r': '\\r',
|
38
|
-
'"' : '\\"',
|
39
|
-
'\\': '\\\\'
|
40
|
-
},
|
41
|
-
s = {
|
42
|
-
'boolean': function (x) {
|
43
|
-
return String(x);
|
44
|
-
},
|
45
|
-
number: function (x) {
|
46
|
-
return isFinite(x) ? String(x) : 'null';
|
47
|
-
},
|
48
|
-
string: function (x) {
|
49
|
-
if (/["\\\x00-\x1f]/.test(x)) {
|
50
|
-
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
|
51
|
-
var c = m[b];
|
52
|
-
if (c) {
|
53
|
-
return c;
|
54
|
-
}
|
55
|
-
c = b.charCodeAt();
|
56
|
-
return '\\u00' +
|
57
|
-
Math.floor(c / 16).toString(16) +
|
58
|
-
(c % 16).toString(16);
|
59
|
-
});
|
60
|
-
}
|
61
|
-
return '"' + x + '"';
|
62
|
-
},
|
63
|
-
object: function (x) {
|
64
|
-
if (x) {
|
65
|
-
var a = [], b, f, i, l, v;
|
66
|
-
if (x instanceof Array) {
|
67
|
-
a[0] = '[';
|
68
|
-
l = x.length;
|
69
|
-
for (i = 0; i < l; i += 1) {
|
70
|
-
v = x[i];
|
71
|
-
f = s[typeof v];
|
72
|
-
if (f) {
|
73
|
-
v = f(v);
|
74
|
-
if (typeof v == 'string') {
|
75
|
-
if (b) {
|
76
|
-
a[a.length] = ',';
|
77
|
-
}
|
78
|
-
a[a.length] = v;
|
79
|
-
b = true;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
a[a.length] = ']';
|
84
|
-
} else if (x instanceof Object) {
|
85
|
-
a[0] = '{';
|
86
|
-
for (i in x) {
|
87
|
-
v = x[i];
|
88
|
-
f = s[typeof v];
|
89
|
-
if (f) {
|
90
|
-
v = f(v);
|
91
|
-
if (typeof v == 'string') {
|
92
|
-
if (b) {
|
93
|
-
a[a.length] = ',';
|
94
|
-
}
|
95
|
-
a.push(s.string(i), ':', v);
|
96
|
-
b = true;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
a[a.length] = '}';
|
101
|
-
} else {
|
102
|
-
return;
|
103
|
-
}
|
104
|
-
return a.join('');
|
105
|
-
}
|
106
|
-
return 'null';
|
107
|
-
}
|
108
|
-
};
|
109
|
-
return {
|
110
|
-
copyright: '(c)2005 JSON.org',
|
111
|
-
license: 'http://www.JSON.org/license.html',
|
112
|
-
/*
|
113
|
-
Stringify a JavaScript value, producing a JSON text.
|
114
|
-
*/
|
115
|
-
stringify: function (v) {
|
116
|
-
var f = s[typeof v];
|
117
|
-
if (f) {
|
118
|
-
v = f(v);
|
119
|
-
if (typeof v == 'string') {
|
120
|
-
return v;
|
121
|
-
}
|
122
|
-
}
|
123
|
-
return null;
|
124
|
-
},
|
125
|
-
/*
|
126
|
-
Parse a JSON text, producing a JavaScript value.
|
127
|
-
It returns false if there is a syntax error.
|
128
|
-
*/
|
129
|
-
parse: function (text) {
|
130
|
-
try {
|
131
|
-
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
|
132
|
-
text.replace(/"(\\.|[^"\\])*"/g, ''))) &&
|
133
|
-
eval('(' + text + ')');
|
134
|
-
} catch (e) {
|
135
|
-
return false;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
};
|
139
|
-
}();
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class Admin::BaseAccountController < Admin::BaseController
|
2
|
-
before_action :set_account
|
3
|
-
|
4
|
-
def set_account
|
5
|
-
@account = current_user.account
|
6
|
-
end
|
7
|
-
|
8
|
-
def require_authentication
|
9
|
-
unless current_user.account
|
10
|
-
return redirect_to_login(t(:'adva.flash.authentication_required'))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
class Admin::InstallController < ApplicationController
|
2
|
-
helper :base
|
3
|
-
|
4
|
-
before_action :normalize_install_params, :only => :index
|
5
|
-
before_action :protect_install, :except => :confirmation
|
6
|
-
|
7
|
-
layout "simple"
|
8
|
-
renders_with_error_proc :below_field
|
9
|
-
|
10
|
-
def index
|
11
|
-
# TODO: can't we somehow encapsulate all this in a single model instead of juggling with 3 different models?
|
12
|
-
params[:section] = params[:section]
|
13
|
-
params[:section] ||= { :title => t(:'adva.sites.install.section_default') }
|
14
|
-
params[:section][:type] ||= 'Page'
|
15
|
-
|
16
|
-
@site = Site.new(params[:site])
|
17
|
-
@section = @site.sections.build(params[:section])
|
18
|
-
@user = User.new(params[:user])
|
19
|
-
@user.name = @user.first_name_from_email
|
20
|
-
@user.verified_at = Time.zone.now
|
21
|
-
|
22
|
-
@article = @section.articles.build({
|
23
|
-
title: t(:'adva.sites.install.section_default'),
|
24
|
-
body: t(:'adva.sites.install.section_default'),
|
25
|
-
author: @user,
|
26
|
-
published_at: Time.zone.now,
|
27
|
-
})
|
28
|
-
|
29
|
-
if request.post?
|
30
|
-
if @site.valid? && @section.valid? && @article.valid? && @user.valid?
|
31
|
-
@site.save
|
32
|
-
@user.admin = true
|
33
|
-
authenticate_user(:email => @user.email, :password => @user.password)
|
34
|
-
|
35
|
-
# default email for site
|
36
|
-
@site.email ||= @user.email
|
37
|
-
@site.save
|
38
|
-
|
39
|
-
flash.now[:notice] = t(:'adva.sites.flash.install.success')
|
40
|
-
render :action => :confirmation
|
41
|
-
else
|
42
|
-
models = [@site, @section, @article, @user].map { |model| model.class.name unless model.valid? }.compact
|
43
|
-
flash.now[:error] = t(:'adva.sites.flash.install.failure', :models => models.join(', '))
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
protected
|
49
|
-
|
50
|
-
def normalize_install_params
|
51
|
-
params[:site] ||= {}
|
52
|
-
params[:site].merge!(:host => request.host_with_port)
|
53
|
-
end
|
54
|
-
|
55
|
-
def protect_install
|
56
|
-
if Site.first || User.first
|
57
|
-
flash[:error] = t(:'adva.sites.flash.install.error_already_complete')
|
58
|
-
redirect_to admin_sites_url
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class Admin::PluginsController < Admin::BaseController
|
2
|
-
before_action :set_plugins, :only => :index
|
3
|
-
before_action :set_plugin, :only => [:show, :edit, :update, :destroy]
|
4
|
-
|
5
|
-
def index
|
6
|
-
end
|
7
|
-
|
8
|
-
def show
|
9
|
-
end
|
10
|
-
|
11
|
-
def update
|
12
|
-
@plugin.options = params[:plugin]
|
13
|
-
@plugin.save!
|
14
|
-
flash[:notice] = t(:'adva.plugins.flash.update.success')
|
15
|
-
redirect_to admin_plugin_url(@plugin)
|
16
|
-
end
|
17
|
-
|
18
|
-
def destroy
|
19
|
-
@plugin.options = {}
|
20
|
-
@plugin.save!
|
21
|
-
flash[:notice] = t(:'adva.plugins.flash.destroy.success')
|
22
|
-
redirect_to admin_plugin_url(@plugin)
|
23
|
-
end
|
24
|
-
|
25
|
-
protected
|
26
|
-
|
27
|
-
def set_menu
|
28
|
-
@menu = Menus::Admin::Plugins.new
|
29
|
-
end
|
30
|
-
|
31
|
-
def set_plugins
|
32
|
-
@plugins = @site.plugins.values
|
33
|
-
end
|
34
|
-
|
35
|
-
def set_plugin
|
36
|
-
@plugin = @site.plugins[params[:id].to_sym] or raise ActiveRecord::RecordNotFound
|
37
|
-
end
|
38
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module MetaTagsHelper
|
2
|
-
DEFAULT_FIELDS = %w(author geourl copyright keywords description)
|
3
|
-
|
4
|
-
def meta_tags(resource=nil)
|
5
|
-
current_resource = controller.try(:current_resource)
|
6
|
-
resources = [resource, current_resource, @site].compact
|
7
|
-
|
8
|
-
# TODO: check if we actually need this fallback
|
9
|
-
# fields = resource.class.try(:meta_fields) || DEFAULT_FIELDS
|
10
|
-
|
11
|
-
DEFAULT_FIELDS.map do |name|
|
12
|
-
resource = resources.find do |r|
|
13
|
-
r.respond_to?(:"meta_#{name}")
|
14
|
-
end
|
15
|
-
|
16
|
-
if resource
|
17
|
-
content = meta_value_from(resource.send(:"meta_#{name}"), resource.try(:"default_meta_#{name}"))
|
18
|
-
meta_tag(name, content)
|
19
|
-
end
|
20
|
-
end.join("\n").html_safe
|
21
|
-
end
|
22
|
-
|
23
|
-
def meta_tag(name, content)
|
24
|
-
tag 'meta', :name => name, :content => content
|
25
|
-
end
|
26
|
-
|
27
|
-
def meta_value_from(*args)
|
28
|
-
args.detect { |arg| arg.present? }
|
29
|
-
end
|
30
|
-
end
|
data/app/models/account.rb
DELETED
data/app/models/event.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
class Event
|
2
|
-
cattr_accessor :observers
|
3
|
-
@@observers = []
|
4
|
-
|
5
|
-
attr_reader :type # what happened
|
6
|
-
attr_reader :object # the object that the event is about, e.g. payment
|
7
|
-
attr_reader :source # the origin or the event, e.g. payment processor
|
8
|
-
attr_reader :options # optional options for the event
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def trigger(type, object, source, options = {})
|
12
|
-
event = Event.new(type, object, source, options)
|
13
|
-
observers.each do |observer|
|
14
|
-
observer = observer.constantize if observer.is_a?(String)
|
15
|
-
callback = :"handle_#{event.type}!"
|
16
|
-
|
17
|
-
if observer.respond_to?(callback)
|
18
|
-
observer.send(callback, event)
|
19
|
-
elsif observer.respond_to?(:handle_event!)
|
20
|
-
observer.handle_event!(event)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def initialize(type, object, source, options = {})
|
27
|
-
@type, @object, @source, @options = type, object, source, options
|
28
|
-
end
|
29
|
-
|
30
|
-
def method_missing(name, *args)
|
31
|
-
return @options[name] if @options.has_key?(name)
|
32
|
-
super
|
33
|
-
end
|
34
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<%= f.text_field :meta_keywords, :label => true, :value => meta_value_from(@article.meta_keywords, @site.meta_keywords), :hint => :'adva.hints.meta_keywords' %>
|
2
|
-
<%= f.text_area :meta_description, :class => 'small', :label => true, :hint => :'adva.hints.meta_description' %>
|
3
|
-
<%= f.text_field :meta_author, :label => true, :value => meta_value_from(@article.meta_author, @site.meta_author, current_user.name) %>
|
4
|
-
<%= f.text_field :meta_copyright, :label => true, :value => meta_value_from(@article.meta_copyright, @site.meta_copyright, "#{Date.today.year}, #{current_user.name}") %>
|
5
|
-
<%= f.text_field :meta_geourl, :label => true, :value => meta_value_from(@article.meta_geourl, @site.meta_geourl),
|
6
|
-
:hint => I18n.t(:'adva.meta_tags.hints.meta_geourl',
|
7
|
-
:meta_geourl_link => link_to(I18n.t(:'adva.meta_tags.hints.meta_geourl_link'), I18n.t(:'adva.meta_tags.hints.meta_geourl_link'), :popup => true)) %>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% content_for :filter do -%>
|
2
|
-
<%= form_tag admin_cached_pages_path, :method => 'get', :id => 'cached_pages_search' do -%>
|
3
|
-
<label for="search" class="inline"><%= t(:'adva.cached_pages.filter.show_cached_pages') %></label>
|
4
|
-
<%= text_field_tag 'query', params[:query], :id => 'query' %>
|
5
|
-
<% end -%>
|
6
|
-
<% end -%>
|
7
|
-
|
8
|
-
|
@@ -1,18 +0,0 @@
|
|
1
|
-
// <%= t(:'adva.cached_pages.confirmation.cleared_short') %>
|
2
|
-
try {
|
3
|
-
// var count = $('p.total strong').pop();
|
4
|
-
// if(count) {
|
5
|
-
// $(count).html(parseInt(count.html()) - 1);
|
6
|
-
// }
|
7
|
-
//
|
8
|
-
// var row = $('#<%= dom_id(@cached_page) %>');
|
9
|
-
// if(row) {
|
10
|
-
// $(row).addClass('deleted');
|
11
|
-
// }
|
12
|
-
|
13
|
-
$('#<%= dom_id(@cached_page) %>').remove();
|
14
|
-
Flash.notice("<%= t(:'adva.cached_pages.confirmation.cleared') %>")
|
15
|
-
|
16
|
-
} catch(e) {
|
17
|
-
alert(e)
|
18
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<%= render :partial => 'filter' %>
|
2
|
-
|
3
|
-
<%
|
4
|
-
table_for @cached_pages do |t|
|
5
|
-
t.column :url, :cached_at, :actions
|
6
|
-
|
7
|
-
# t.head.row do |r|
|
8
|
-
# r.cell t(:'adva.cached_pages.total_with_count', :count => @cached_pages.total_entries), :class => :total, :colspan => :all
|
9
|
-
# end
|
10
|
-
|
11
|
-
t.row do |r, cached_page|
|
12
|
-
r.cell cached_page.url
|
13
|
-
r.cell page_cached_at(cached_page)
|
14
|
-
r.cell link_to(t(:'adva.titles.clear'), admin_cached_page_path(cached_page), :class => 'text clear')
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
t.foot.row do |r|
|
19
|
-
r.cell will_paginate(@cached_pages), :class => :pagination, :colspan => :all
|
20
|
-
end
|
21
|
-
|
22
|
-
t.empty :p, :class => 'empty' do
|
23
|
-
t(params[:query].present? ? :'adva.cached_pages.no_entries_matching_criteria' : :'adva.cached_pages.no_entries')
|
24
|
-
end
|
25
|
-
end
|
26
|
-
%>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
table_for @plugins do |t|
|
3
|
-
t.column :name, :version, :author, :homepage
|
4
|
-
|
5
|
-
t.row do |r, plugin|
|
6
|
-
r.cell link_to_show(plugin.name, plugin, :class => 'plugin')
|
7
|
-
r.cell plugin.about['version']
|
8
|
-
r.cell plugin.about['author']
|
9
|
-
r.cell plugin.about['homepage']
|
10
|
-
end
|
11
|
-
|
12
|
-
t.empty :p, :class => 'empty' do
|
13
|
-
t(:'adva.plugins.no_plugins_installed')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
%>
|
@@ -1,43 +0,0 @@
|
|
1
|
-
<% content_for :sidebar do %>
|
2
|
-
<% if @plugin.about.detect { |key, value| value.present? } %>
|
3
|
-
<div class="tabs">
|
4
|
-
<ul>
|
5
|
-
<li class="active"><a href="#about" onclick="return false;"><%= t(:'adva.common.about') %></a></li>
|
6
|
-
</ul>
|
7
|
-
<div class="tab active">
|
8
|
-
<% if @plugin.about['summary'] %>
|
9
|
-
<p><%= @plugin.about['summary'] %></p>
|
10
|
-
<% end %>
|
11
|
-
<% if @plugin.about['version'] %>
|
12
|
-
<p><%= t(:'adva.plugins.attributes.version') %>: <%= @plugin.about['version'] %></p>
|
13
|
-
<% end %>
|
14
|
-
<% if @plugin.about['author'] %>
|
15
|
-
<p><%= t(:'adva.plugins.attributes.author') %>: <%= @plugin.about['author'] %></p>
|
16
|
-
<% end %>
|
17
|
-
<% if @plugin.about['homepage'] %>
|
18
|
-
<p><%= t(:'adva.plugins.attributes.homepage') %>: <%= @plugin.about['homepage'] %></p>
|
19
|
-
<% end %>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
|
25
|
-
<% if @plugin.about['description'] %>
|
26
|
-
<h3><%= t(:'adva.titles.plugin') %>: <%= @plugin.name %></h3>
|
27
|
-
<p><%= @plugin.about['description'] %></p>
|
28
|
-
<% end %>
|
29
|
-
|
30
|
-
<h3><%= t(:'adva.titles.settings') %></h3>
|
31
|
-
|
32
|
-
<% if @plugin.option_definitions.present? %>
|
33
|
-
<%= form_for :plugin, @plugin, :url => admin_plugin_path, :html => { :method => :put } do |f| -%>
|
34
|
-
<%= render :partial => 'form', :locals => {:f => f} %>
|
35
|
-
<% f.buttons do %>
|
36
|
-
<%= f.submit :Save %>
|
37
|
-
<% end %>
|
38
|
-
<% end -%>
|
39
|
-
<% else %>
|
40
|
-
<p class="empty">
|
41
|
-
<%= t(:'adva.plugins.no_config_options_available') %>
|
42
|
-
</p>
|
43
|
-
<% end %>
|