camaleon_cms 2.1.1 → 2.1.1.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +35 -1
- data/app/apps/plugins/attack/config/locales/translation.yml +20 -1
- data/app/apps/plugins/contact_form/config/locales/translation.yml +106 -1
- data/app/apps/plugins/contact_form/contact_form_helper.rb +44 -27
- data/app/apps/plugins/front_cache/config/locales/translation.yml +21 -1
- data/app/apps/plugins/front_cache/front_cache_helper.rb +1 -1
- data/app/apps/plugins/visibility_post/assets/js/form.js +1 -3
- data/app/apps/plugins/visibility_post/visibility_post_helper.rb +2 -4
- data/app/assets/images/camaleon_cms/language/de.png +0 -0
- data/app/assets/images/camaleon_cms/language/en.png +0 -0
- data/app/assets/images/camaleon_cms/language/es.png +0 -0
- data/app/assets/images/camaleon_cms/language/fr.png +0 -0
- data/app/assets/images/camaleon_cms/language/it.png +0 -0
- data/app/assets/images/camaleon_cms/language/nl.png +0 -0
- data/app/assets/images/camaleon_cms/language/pl.png +0 -0
- data/app/assets/images/camaleon_cms/language/pt.png +0 -0
- data/app/assets/images/camaleon_cms/language/pt_br.png +0 -0
- data/app/assets/images/camaleon_cms/language/ru.png +0 -0
- data/app/assets/images/camaleon_cms/language/zh.png +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/_custom_fields.js +3 -11
- data/app/assets/javascripts/camaleon_cms/admin/_data.js +2 -6
- data/app/assets/javascripts/camaleon_cms/admin/_libraries.js +11 -229
- data/app/assets/javascripts/camaleon_cms/admin/_modal.js +11 -37
- data/app/assets/javascripts/camaleon_cms/admin/_post.js +27 -22
- data/app/assets/javascripts/camaleon_cms/admin/_translator.js +2 -1
- data/app/assets/javascripts/camaleon_cms/admin/admin-manifest.js +6 -2
- data/app/assets/javascripts/camaleon_cms/admin/bootstrap-datepicker.js +2557 -1689
- data/app/assets/javascripts/camaleon_cms/admin/jquery.validate.js +119 -1361
- data/app/assets/javascripts/camaleon_cms/admin/jquery_validate/nl.js +33 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/_moment.js +3606 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ar.js +136 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ca.js +79 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/de.js +76 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/es.js +79 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/fr.js +62 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/it.js +70 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ja.js +65 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/nl.js +71 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/pl.js +105 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/pt.js +64 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/pt_br.js +60 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/ru.js +166 -0
- data/app/assets/javascripts/camaleon_cms/admin/momentjs/zh.js +127 -0
- data/app/assets/javascripts/camaleon_cms/admin/nav-menu.js +15 -25
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/langs/nl.js +219 -0
- data/app/assets/javascripts/camaleon_cms/admin/uploader/_media_manager.js.coffee +82 -19
- data/app/assets/javascripts/camaleon_cms/admin/user_profile.js +8 -8
- data/app/assets/stylesheets/camaleon_cms/admin/_custom_admin.css.scss +19 -2
- data/app/assets/stylesheets/camaleon_cms/admin/admin-manifest.css +0 -4
- data/app/assets/stylesheets/camaleon_cms/admin/bootstrap-datepicker.css.scss +315 -414
- data/app/assets/stylesheets/camaleon_cms/admin/uploader/_uploadfile.css.scss +7 -3
- data/app/controllers/camaleon_cms/admin/appearances/nav_menus_controller.rb +9 -5
- data/app/controllers/camaleon_cms/admin/categories_controller.rb +5 -0
- data/app/controllers/camaleon_cms/admin/media_controller.rb +27 -10
- data/app/controllers/camaleon_cms/admin/posts_controller.rb +9 -19
- data/app/controllers/camaleon_cms/admin/sessions_controller.rb +3 -10
- data/app/controllers/camaleon_cms/admin/settings/custom_fields_controller.rb +0 -1
- data/app/controllers/camaleon_cms/admin/settings/sites_controller.rb +6 -1
- data/app/controllers/camaleon_cms/admin/users_controller.rb +1 -8
- data/app/controllers/camaleon_cms/admin_controller.rb +5 -4
- data/app/controllers/camaleon_cms/apps/plugins_front_controller.rb +0 -8
- data/app/controllers/camaleon_cms/camaleon_controller.rb +6 -1
- data/app/controllers/camaleon_cms/frontend_controller.rb +11 -8
- data/app/decorators/camaleon_cms/category_decorator.rb +2 -1
- data/app/decorators/camaleon_cms/post_decorator.rb +28 -1
- data/app/decorators/camaleon_cms/post_tag_decorator.rb +1 -0
- data/app/decorators/camaleon_cms/post_type_decorator.rb +17 -0
- data/app/decorators/camaleon_cms/site_decorator.rb +22 -7
- data/app/decorators/camaleon_cms/user_decorator.rb +1 -0
- data/app/helpers/camaleon_cms/admin/application_helper.rb +3 -2
- data/app/helpers/camaleon_cms/admin/custom_fields_helper.rb +13 -25
- data/app/helpers/camaleon_cms/admin/post_type_helper.rb +27 -2
- data/app/helpers/camaleon_cms/camaleon_helper.rb +0 -16
- data/app/helpers/camaleon_cms/captcha_helper.rb +9 -3
- data/app/helpers/camaleon_cms/email_helper.rb +27 -8
- data/app/helpers/camaleon_cms/frontend/nav_menu_helper.rb +21 -17
- data/app/helpers/camaleon_cms/frontend/seo_helper.rb +5 -3
- data/app/helpers/camaleon_cms/html_helper.rb +2 -2
- data/app/helpers/camaleon_cms/site_helper.rb +10 -14
- data/app/helpers/camaleon_cms/uploader_helper.rb +119 -31
- data/app/mailers/camaleon_cms/html_mailer.rb +26 -20
- data/app/models/camaleon_cms/custom_field.rb +1 -0
- data/app/models/camaleon_cms/custom_field_group.rb +2 -1
- data/app/models/camaleon_cms/nav_menu.rb +6 -7
- data/app/models/camaleon_cms/nav_menu_item.rb +2 -1
- data/app/models/camaleon_cms/post.rb +29 -2
- data/app/models/camaleon_cms/post_type.rb +20 -1
- data/app/models/camaleon_cms/site.rb +19 -19
- data/app/models/camaleon_cms/term_taxonomy.rb +1 -1
- data/app/models/concerns/camaleon_cms/custom_fields_read.rb +6 -4
- data/app/models/concerns/camaleon_cms/metas.rb +5 -4
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_custom_fields.html.erb +4 -2
- data/app/views/camaleon_cms/admin/appearances/nav_menus/_external_menu.html.erb +1 -1
- data/app/views/camaleon_cms/admin/appearances/nav_menus/index.html.erb +3 -6
- data/app/views/camaleon_cms/admin/categories/index.html.erb +1 -0
- data/app/views/camaleon_cms/admin/media/_files_list.html.erb +3 -3
- data/app/views/camaleon_cms/admin/media/_render_file_item.html.erb +3 -2
- data/app/views/camaleon_cms/admin/media/index.html.erb +31 -4
- data/app/views/camaleon_cms/admin/posts/_sidebar.html.erb +10 -1
- data/app/views/camaleon_cms/admin/posts/form.html.erb +6 -2
- data/app/views/camaleon_cms/admin/posts/index.html.erb +4 -4
- data/app/views/camaleon_cms/admin/search.html.erb +5 -3
- data/app/views/camaleon_cms/admin/settings/_file_system_settings.html.erb +5 -5
- data/app/views/camaleon_cms/admin/settings/custom_fields/_get_items.html.erb +2 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/_render.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_date.html.erb +3 -4
- data/app/views/camaleon_cms/admin/settings/custom_fields/fields/_image.html.erb +1 -1
- data/app/views/camaleon_cms/admin/settings/custom_fields/form.html.erb +2 -2
- data/app/views/camaleon_cms/admin/settings/post_types/_form.html.erb +11 -1
- data/app/views/camaleon_cms/admin/settings/post_types/index.html.erb +1 -0
- data/app/views/camaleon_cms/admin/users/form.html.erb +30 -55
- data/app/views/camaleon_cms/html_mailer/mailer.html.erb +1 -1
- data/app/views/camaleon_cms/html_mailer/password_reset.html.erb +3 -0
- data/app/views/layouts/camaleon_cms/admin.html.erb +4 -1
- data/app/views/layouts/camaleon_cms/admin/_ajax.html.erb +3 -1
- data/app/views/layouts/camaleon_cms/admin/_footer.html.erb +1 -1
- data/app/views/layouts/camaleon_cms/admin/_header.html.erb +1 -1
- data/config/initializers/assets.rb +4 -2
- data/config/initializers/model_alias.rb +11 -0
- data/config/locales/camaleon_cms/admin/en.yml +2 -0
- data/config/locales/camaleon_cms/admin/es.yml +2 -1
- data/config/locales/camaleon_cms/admin/it.yml +1 -0
- data/config/locales/camaleon_cms/admin/js.yml +42 -1
- data/config/locales/camaleon_cms/admin/nl.yml +659 -0
- data/config/locales/camaleon_cms/admin/pt_br.yml +1 -0
- data/config/locales/camaleon_cms/admin/ru.yml +659 -0
- data/config/locales/camaleon_cms/common.yml +127 -0
- data/config/locales/camaleon_cms/languages.yml +16 -0
- data/config/locales/camaleon_cms/routes.yml +8 -0
- data/config/locales/nl.yml +209 -0
- data/config/routes.rb +1 -1
- data/config/routes/admin.rb +5 -4
- data/config/routes/frontend.rb +16 -3
- data/config/system.json +2 -3
- data/lib/camaleon_cms/engine.rb +5 -1
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/ext/array.rb +5 -0
- data/lib/generators/camaleon_cms/gem_plugin_generator.rb +1 -1
- data/lib/generators/camaleon_cms/gem_plugin_template/app/models/plugins/my_plugin/my_plugin.rb +1 -2
- data/lib/generators/camaleon_cms/gem_plugin_template/config/{custom_models.rb → initializers/custom_models.rb} +0 -0
- data/lib/plugin_routes.rb +38 -63
- data/lib/tasks/camaleon_cms/camaleon_tasks.rake +18 -0
- data/lib/tasks/camaleon_cms/rspec_test.rake +7 -4
- metadata +43 -54
- data/app/assets/javascripts/camaleon_cms/admin/bootstrap-datetimepicker.min.js +0 -26
- data/app/assets/javascripts/camaleon_cms/admin/plugins.js +0 -637
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/plugins/visualblocks/css/visualblocks.css +0 -135
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/content.min.css.scss +0 -4
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.svg +0 -62
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.svg +0 -83
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/object.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/themes/modern/theme.min.js +0 -1
- data/app/assets/javascripts/camaleon_cms/admin/tinymce/tinymce.min.js +0 -11
- data/app/assets/stylesheets/camaleon_cms/admin/bootstrap-datetimepicker.css.scss +0 -339
@@ -0,0 +1,127 @@
|
|
1
|
+
//! moment.js locale configuration
|
2
|
+
//! locale : chinese (zh-cn)
|
3
|
+
//! author : suupic : https://github.com/suupic
|
4
|
+
//! author : Zeno Zeng : https://github.com/zenozeng
|
5
|
+
|
6
|
+
;(function (global, factory) {
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined'
|
8
|
+
&& typeof require === 'function' ? factory(require('../moment')) :
|
9
|
+
typeof define === 'function' && define.amd ? define(['moment'], factory) :
|
10
|
+
factory(global.moment)
|
11
|
+
}(this, function (moment) { 'use strict';
|
12
|
+
|
13
|
+
|
14
|
+
var zh_cn = moment.defineLocale('zh-cn', {
|
15
|
+
months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
|
16
|
+
monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
|
17
|
+
weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
|
18
|
+
weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
|
19
|
+
weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
|
20
|
+
longDateFormat : {
|
21
|
+
LT : 'Ah点mm分',
|
22
|
+
LTS : 'Ah点m分s秒',
|
23
|
+
L : 'YYYY-MM-DD',
|
24
|
+
LL : 'YYYY年MMMD日',
|
25
|
+
LLL : 'YYYY年MMMD日Ah点mm分',
|
26
|
+
LLLL : 'YYYY年MMMD日ddddAh点mm分',
|
27
|
+
l : 'YYYY-MM-DD',
|
28
|
+
ll : 'YYYY年MMMD日',
|
29
|
+
lll : 'YYYY年MMMD日Ah点mm分',
|
30
|
+
llll : 'YYYY年MMMD日ddddAh点mm分'
|
31
|
+
},
|
32
|
+
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
|
33
|
+
meridiemHour: function (hour, meridiem) {
|
34
|
+
if (hour === 12) {
|
35
|
+
hour = 0;
|
36
|
+
}
|
37
|
+
if (meridiem === '凌晨' || meridiem === '早上' ||
|
38
|
+
meridiem === '上午') {
|
39
|
+
return hour;
|
40
|
+
} else if (meridiem === '下午' || meridiem === '晚上') {
|
41
|
+
return hour + 12;
|
42
|
+
} else {
|
43
|
+
// '中午'
|
44
|
+
return hour >= 11 ? hour : hour + 12;
|
45
|
+
}
|
46
|
+
},
|
47
|
+
meridiem : function (hour, minute, isLower) {
|
48
|
+
var hm = hour * 100 + minute;
|
49
|
+
if (hm < 600) {
|
50
|
+
return '凌晨';
|
51
|
+
} else if (hm < 900) {
|
52
|
+
return '早上';
|
53
|
+
} else if (hm < 1130) {
|
54
|
+
return '上午';
|
55
|
+
} else if (hm < 1230) {
|
56
|
+
return '中午';
|
57
|
+
} else if (hm < 1800) {
|
58
|
+
return '下午';
|
59
|
+
} else {
|
60
|
+
return '晚上';
|
61
|
+
}
|
62
|
+
},
|
63
|
+
calendar : {
|
64
|
+
sameDay : function () {
|
65
|
+
return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
|
66
|
+
},
|
67
|
+
nextDay : function () {
|
68
|
+
return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
|
69
|
+
},
|
70
|
+
lastDay : function () {
|
71
|
+
return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
|
72
|
+
},
|
73
|
+
nextWeek : function () {
|
74
|
+
var startOfWeek, prefix;
|
75
|
+
startOfWeek = moment().startOf('week');
|
76
|
+
prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
|
77
|
+
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
78
|
+
},
|
79
|
+
lastWeek : function () {
|
80
|
+
var startOfWeek, prefix;
|
81
|
+
startOfWeek = moment().startOf('week');
|
82
|
+
prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
|
83
|
+
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
84
|
+
},
|
85
|
+
sameElse : 'LL'
|
86
|
+
},
|
87
|
+
ordinalParse: /\d{1,2}(日|月|周)/,
|
88
|
+
ordinal : function (number, period) {
|
89
|
+
switch (period) {
|
90
|
+
case 'd':
|
91
|
+
case 'D':
|
92
|
+
case 'DDD':
|
93
|
+
return number + '日';
|
94
|
+
case 'M':
|
95
|
+
return number + '月';
|
96
|
+
case 'w':
|
97
|
+
case 'W':
|
98
|
+
return number + '周';
|
99
|
+
default:
|
100
|
+
return number;
|
101
|
+
}
|
102
|
+
},
|
103
|
+
relativeTime : {
|
104
|
+
future : '%s内',
|
105
|
+
past : '%s前',
|
106
|
+
s : '几秒',
|
107
|
+
m : '1 分钟',
|
108
|
+
mm : '%d 分钟',
|
109
|
+
h : '1 小时',
|
110
|
+
hh : '%d 小时',
|
111
|
+
d : '1 天',
|
112
|
+
dd : '%d 天',
|
113
|
+
M : '1 个月',
|
114
|
+
MM : '%d 个月',
|
115
|
+
y : '1 年',
|
116
|
+
yy : '%d 年'
|
117
|
+
},
|
118
|
+
week : {
|
119
|
+
// GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
|
120
|
+
dow : 1, // Monday is the first day of the week.
|
121
|
+
doy : 4 // The week that contains Jan 4th is the first week of the year.
|
122
|
+
}
|
123
|
+
});
|
124
|
+
|
125
|
+
return zh_cn;
|
126
|
+
|
127
|
+
}));
|
@@ -6,6 +6,7 @@ function do_add_item_menu(data){
|
|
6
6
|
var link = data.link ? data.link.toString() : "";
|
7
7
|
var parent_id = data.parent_id;
|
8
8
|
var extra_html = data.extra_html;
|
9
|
+
var item_id = data.item_id;
|
9
10
|
var id = data.id ? data.id : $("#nestable .dd-item").length + 1;
|
10
11
|
|
11
12
|
var link_data = '';
|
@@ -20,7 +21,7 @@ function do_add_item_menu(data){
|
|
20
21
|
// custom fields icon
|
21
22
|
if(main_menus_panel.attr("data-fields_support") == "true") link_data += '<a class="text-edit" title="'+I18n("button.settings")+'" href="'+data.url_content+'" onclick="do_settings_menu(this); return false;" rel="1"><i class="fa fa-cog"></i></a>';
|
22
23
|
|
23
|
-
var item = $('<li class="dd-item dd3-item" data-type="'+type+'" data-id="'+id+'" data-parent="'+(parent_id ? parent_id : "")+'"><div class="dd-handle dd3-handle"></div> <div class="dd3-content"><span>'+text + "</span> " + extra_html +' <span class="label">'+type+'</span> '+ link_data +' <a href="#" onclick="do_delete_menu(this); return false;" class="text-danger" title="'+I18n("button.delete")+'"><i class="fa fa-times-circle"></i></a> </div></li>');
|
24
|
+
var item = $('<li class="dd-item dd3-item" data-type="'+type+'" data-id="'+id+'" data-item_id="'+item_id+'" data-parent="'+(parent_id ? parent_id : "")+'"><div class="dd-handle dd3-handle"></div> <div class="dd3-content"><span>'+text + "</span> " + extra_html +' <span class="label">'+type+'</span> '+ link_data +' <a href="#" onclick="do_delete_menu(this); return false;" class="text-danger" title="'+I18n("button.delete")+'"><i class="fa fa-times-circle"></i></a> </div></li>');
|
24
25
|
item.attr("data-fields", data.fields).attr("data-label", text).attr("data-link", link);
|
25
26
|
if(parent_id > 0)
|
26
27
|
{
|
@@ -91,15 +92,15 @@ function do_delete_menu(link){
|
|
91
92
|
// edit form for custom links
|
92
93
|
function do_edit_menu(link){
|
93
94
|
var li = $(link).closest("li");
|
94
|
-
open_modal({title: "Edit Menu", url:
|
95
|
+
open_modal({title: "Edit Menu", url: RENDER_FORM.replace('-9999', li.attr('data-item_id')), mode: "ajax", callback: function(modal){
|
95
96
|
modal.find(".panel-footer").html("<button type='submit' class='btn btn-primary'>Update</button>");
|
96
97
|
var form = modal.find("form");
|
97
|
-
form.find("#external_label").val(li.
|
98
|
-
form.find("#external_url").val(li.
|
98
|
+
form.find("#external_label").val(li.data("label"));
|
99
|
+
form.find("#external_url").val(li.data("link"));
|
99
100
|
init_form_validations(form);
|
100
101
|
form.submit(function(){
|
101
|
-
li.
|
102
|
-
li.
|
102
|
+
li.data("label", form.find("#external_label").val());
|
103
|
+
li.data("link", form.find("#external_url").val());
|
103
104
|
li.children(".dd3-content").children("span:first").html(form.find("#external_label").val());
|
104
105
|
modal.modal("hide");
|
105
106
|
return false;
|
@@ -111,27 +112,13 @@ function do_edit_menu(link){
|
|
111
112
|
// edit form for custom fields
|
112
113
|
function do_settings_menu(link){
|
113
114
|
var li = $(link).closest("li");
|
114
|
-
open_modal({title: "Configuration Menu", url:
|
115
|
+
open_modal({id: 'menu_item_'+li.attr('data-id'), title: "Configuration Menu", url: RENDER_FORM.replace('-9999', li.attr('data-item_id'))+"&custom_fields=true", mode: "ajax", callback: function(modal){
|
116
|
+
modal.attr('data-skip_destroy', true);
|
115
117
|
var form = modal.find("form");
|
116
|
-
setTimeout(function(){
|
117
|
-
form.find(".translated-item").trigger("trans_integrate");
|
118
|
-
var data = eval("("+(li.attr("data-fields")||"{}")+")");
|
119
|
-
for(var key in data){
|
120
|
-
if(data[key]) form.find("[name='field_options["+key+"][values][]']").val(data[key]);
|
121
|
-
}
|
122
|
-
init_form_validations(form);
|
123
|
-
}, 300);
|
124
118
|
form.submit(function(){
|
125
119
|
if(!form.valid()) return false;
|
126
|
-
form.find(".
|
127
|
-
|
128
|
-
var form_fields = form.serializeObject().field_options;
|
129
|
-
console.log(form_fields);
|
130
|
-
for(var key in form_fields){
|
131
|
-
data[key] = form.find("[name='field_options["+key+"][values][]']").val();
|
132
|
-
console.log("ssss", data);
|
133
|
-
}
|
134
|
-
li.attr("data-fields", JSON.stringify(data));
|
120
|
+
form.find(".translate-item").trigger("change_in");
|
121
|
+
li.attr("data-fields", JSON.stringify(form.serializeObject().field_options));
|
135
122
|
modal.modal("hide");
|
136
123
|
return false;
|
137
124
|
});
|
@@ -143,7 +130,7 @@ function do_settings_menu(link){
|
|
143
130
|
function render_menu(items){
|
144
131
|
$.each(items, function (i, item) {
|
145
132
|
var r_id = do_add_item_menu({
|
146
|
-
|
133
|
+
item_id: item.id,
|
147
134
|
type: item.type,
|
148
135
|
link: item.link,
|
149
136
|
url_edit: item.url_edit,
|
@@ -170,6 +157,9 @@ function render_menu(items){
|
|
170
157
|
}
|
171
158
|
});
|
172
159
|
|
160
|
+
// change menu selector
|
161
|
+
$("#menu_items #menu").change(function(){ $(this).closest('form').submit(); });
|
162
|
+
|
173
163
|
// save menu items (main form)
|
174
164
|
$("#menu_form").submit(function () {
|
175
165
|
var menu_data = $('#nestable').nestable("serialize").length == 0 ? [] : $('#nestable').nestable("serialize");
|
@@ -0,0 +1,219 @@
|
|
1
|
+
tinymce.addI18n('nl',{
|
2
|
+
"Cut": "Knippen",
|
3
|
+
"Heading 5": "Kop 5",
|
4
|
+
"Header 2": "Kop 2",
|
5
|
+
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Uw browser ondersteunt geen toegang tot het klembord. Gelieve ctrl+X\/C\/V sneltoetsen te gebruiken.",
|
6
|
+
"Heading 4": "Kop 4",
|
7
|
+
"Div": "Div",
|
8
|
+
"Heading 2": "Kop 2",
|
9
|
+
"Paste": "Plakken",
|
10
|
+
"Close": "Sluiten",
|
11
|
+
"Font Family": "Lettertype",
|
12
|
+
"Pre": "Pre",
|
13
|
+
"Align right": "Rechts uitlijnen",
|
14
|
+
"New document": "Nieuw document",
|
15
|
+
"Blockquote": "Quote",
|
16
|
+
"Numbered list": "Nummering",
|
17
|
+
"Heading 1": "Kop 1",
|
18
|
+
"Headings": "Koppen",
|
19
|
+
"Increase indent": "Inspringing vergroten",
|
20
|
+
"Formats": "Opmaak",
|
21
|
+
"Headers": "Kopteksten",
|
22
|
+
"Select all": "Alles selecteren",
|
23
|
+
"Header 3": "Kop 3",
|
24
|
+
"Blocks": "Blok",
|
25
|
+
"Undo": "Ongedaan maken",
|
26
|
+
"Strikethrough": "Doorhalen",
|
27
|
+
"Bullet list": "Opsommingsteken",
|
28
|
+
"Header 1": "Kop 1",
|
29
|
+
"Superscript": "Superscript",
|
30
|
+
"Clear formatting": "Opmaak verwijderen",
|
31
|
+
"Font Sizes": "Tekengrootte",
|
32
|
+
"Subscript": "Subscript",
|
33
|
+
"Header 6": "Kop 6",
|
34
|
+
"Redo": "Opnieuw",
|
35
|
+
"Paragraph": "Paragraaf",
|
36
|
+
"Ok": "Ok\u00e9",
|
37
|
+
"Bold": "Vet",
|
38
|
+
"Code": "Code",
|
39
|
+
"Italic": "Cursief",
|
40
|
+
"Align center": "Centreren",
|
41
|
+
"Header 5": "Kop 5",
|
42
|
+
"Heading 6": "Kop 6",
|
43
|
+
"Heading 3": "Kop 3",
|
44
|
+
"Decrease indent": "Inspringing verkleinen",
|
45
|
+
"Header 4": "Kop 4",
|
46
|
+
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Plakken gebeurt nu als platte tekst. Tekst wordt nu ingevoegd zonder opmaak tot deze optie uitgeschakeld wordt.",
|
47
|
+
"Underline": "Onderstreept",
|
48
|
+
"Cancel": "Annuleren",
|
49
|
+
"Justify": "Uitlijnen",
|
50
|
+
"Inline": "Inlijn",
|
51
|
+
"Copy": "Kopi\u00ebren",
|
52
|
+
"Align left": "Links uitlijnen",
|
53
|
+
"Visual aids": "Hulpmiddelen",
|
54
|
+
"Lower Greek": "Griekse letters",
|
55
|
+
"Square": "Vierkant",
|
56
|
+
"Default": "Standaard",
|
57
|
+
"Lower Alpha": "Kleine letters",
|
58
|
+
"Circle": "Cirkel",
|
59
|
+
"Disc": "Bolletje",
|
60
|
+
"Upper Alpha": "Hoofdletters",
|
61
|
+
"Upper Roman": "Romeinse cijfers groot",
|
62
|
+
"Lower Roman": "Romeinse cijfers klein",
|
63
|
+
"Name": "Naam",
|
64
|
+
"Anchor": "Anker",
|
65
|
+
"You have unsaved changes are you sure you want to navigate away?": "U hebt niet opgeslagen wijzigingen! Wilt u de pagina echt verlaten?",
|
66
|
+
"Restore last draft": "Herstel het laatste concept",
|
67
|
+
"Special character": "Speciale karakters",
|
68
|
+
"Source code": "Broncode",
|
69
|
+
"B": "Blauw",
|
70
|
+
"R": "Rood",
|
71
|
+
"G": "Groen",
|
72
|
+
"Color": "Kleur",
|
73
|
+
"Right to left": "Rechts naar links",
|
74
|
+
"Left to right": "Links naar rechts",
|
75
|
+
"Emoticons": "Emoticons",
|
76
|
+
"Robots": "Robots",
|
77
|
+
"Document properties": "Document eigenschappen",
|
78
|
+
"Title": "Titel",
|
79
|
+
"Keywords": "Sleutelwoorden",
|
80
|
+
"Encoding": "Codering",
|
81
|
+
"Description": "Omschrijving",
|
82
|
+
"Author": "Auteur",
|
83
|
+
"Fullscreen": "Volledig scherm",
|
84
|
+
"Horizontal line": "Horizontale lijn",
|
85
|
+
"Horizontal space": "Horizontale ruimte",
|
86
|
+
"Insert\/edit image": "Afbeelding invoegen\/bewerken",
|
87
|
+
"General": "Algemeen",
|
88
|
+
"Advanced": "Geavanceerd",
|
89
|
+
"Source": "Bron",
|
90
|
+
"Border": "Rand",
|
91
|
+
"Constrain proportions": "Verhoudingen behouden",
|
92
|
+
"Vertical space": "Verticale ruimte",
|
93
|
+
"Image description": "Afbeelding omschrijving",
|
94
|
+
"Style": "Stijl",
|
95
|
+
"Dimensions": "Afmetingen",
|
96
|
+
"Insert image": "Afbeelding invoegen",
|
97
|
+
"Zoom in": "Inzoomen",
|
98
|
+
"Contrast": "Contrast",
|
99
|
+
"Back": "Terug",
|
100
|
+
"Gamma": "Gamma",
|
101
|
+
"Flip horizontally": "Horizontaal spiegelen",
|
102
|
+
"Resize": "Formaat aanpassen",
|
103
|
+
"Sharpen": "Scherpte",
|
104
|
+
"Zoom out": "Uitzoomen",
|
105
|
+
"Image options": "Afbeelding opties",
|
106
|
+
"Apply": "Toepassen",
|
107
|
+
"Brightness": "Helderheid",
|
108
|
+
"Rotate clockwise": "Rechtsom draaien",
|
109
|
+
"Rotate counterclockwise": "Linksom draaien",
|
110
|
+
"Edit image": "Bewerk afbeelding",
|
111
|
+
"Color levels": "Kleurniveau's",
|
112
|
+
"Crop": "Uitsnijden",
|
113
|
+
"Orientation": "Orientatie",
|
114
|
+
"Flip vertically": "Verticaal spiegelen",
|
115
|
+
"Invert": "Omkeren",
|
116
|
+
"Insert date\/time": "Voeg datum\/tijd in",
|
117
|
+
"Remove link": "Link verwijderen",
|
118
|
+
"Url": "Url",
|
119
|
+
"Text to display": "Linktekst",
|
120
|
+
"Anchors": "Anker",
|
121
|
+
"Insert link": "Hyperlink invoegen",
|
122
|
+
"New window": "Nieuw venster",
|
123
|
+
"None": "Geen",
|
124
|
+
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "De ingegeven URL verwijst naar een extern adres. Wil je er \"http:\/\/\" aan toevoegen?",
|
125
|
+
"Target": "Doel",
|
126
|
+
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "De ingegeven URL lijkt op een e-mailadres. Wil je er \"mailto:\" aan toevoegen?",
|
127
|
+
"Insert\/edit link": "Hyperlink invoegen\/bewerken",
|
128
|
+
"Insert\/edit video": "Video invoegen\/bewerken",
|
129
|
+
"Poster": "Poster",
|
130
|
+
"Alternative source": "Alternatieve bron",
|
131
|
+
"Paste your embed code below:": "Plak u in te sluiten code hieronder:",
|
132
|
+
"Insert video": "Video invoegen",
|
133
|
+
"Embed": "Insluiten",
|
134
|
+
"Nonbreaking space": "Vaste spatie invoegen",
|
135
|
+
"Page break": "Pagina einde",
|
136
|
+
"Paste as text": "Plakken als tekst",
|
137
|
+
"Preview": "Voorbeeld",
|
138
|
+
"Print": "Print",
|
139
|
+
"Save": "Opslaan",
|
140
|
+
"Could not find the specified string.": "Kan de opgegeven tekenreeks niet vinden",
|
141
|
+
"Replace": "Vervangen",
|
142
|
+
"Next": "Volgende",
|
143
|
+
"Whole words": "Alleen hele woorden",
|
144
|
+
"Find and replace": "Zoek en vervang",
|
145
|
+
"Replace with": "Vervangen door",
|
146
|
+
"Find": "Zoeken",
|
147
|
+
"Replace all": "Alles vervangen",
|
148
|
+
"Match case": "Identieke hoofd\/kleine letters",
|
149
|
+
"Prev": "Vorige",
|
150
|
+
"Spellcheck": "Spellingscontrole",
|
151
|
+
"Finish": "Einde",
|
152
|
+
"Ignore all": "Alles negeren",
|
153
|
+
"Ignore": "Negeren",
|
154
|
+
"Add to Dictionary": "Toevoegen aan woordenlijst",
|
155
|
+
"Insert row before": "Voeg rij boven toe",
|
156
|
+
"Rows": "Rijen",
|
157
|
+
"Height": "Hoogte",
|
158
|
+
"Paste row after": "Plak rij onder",
|
159
|
+
"Alignment": "Uitlijning",
|
160
|
+
"Border color": "Randkleur",
|
161
|
+
"Column group": "Kolomgroep",
|
162
|
+
"Row": "Rij",
|
163
|
+
"Insert column before": "Voeg kolom in voor",
|
164
|
+
"Split cell": "Cel splitsen",
|
165
|
+
"Cell padding": "Ruimte binnen cel",
|
166
|
+
"Cell spacing": "Celruimte",
|
167
|
+
"Row type": "Rijtype",
|
168
|
+
"Insert table": "Tabel invoegen",
|
169
|
+
"Body": "Body",
|
170
|
+
"Caption": "Onderschrift",
|
171
|
+
"Footer": "Voettekst",
|
172
|
+
"Delete row": "Verwijder rij",
|
173
|
+
"Paste row before": "Plak rij boven",
|
174
|
+
"Scope": "Bereik",
|
175
|
+
"Delete table": "Verwijder tabel",
|
176
|
+
"H Align": "Links uitlijnen",
|
177
|
+
"Top": "Bovenaan",
|
178
|
+
"Header cell": "Kopcel",
|
179
|
+
"Column": "Kolom",
|
180
|
+
"Row group": "Rijgroep",
|
181
|
+
"Cell": "Cel",
|
182
|
+
"Middle": "Centreren",
|
183
|
+
"Cell type": "Celtype",
|
184
|
+
"Copy row": "Kopieer rij",
|
185
|
+
"Row properties": "Rij eigenschappen",
|
186
|
+
"Table properties": "Tabel eigenschappen",
|
187
|
+
"Bottom": "Onderaan",
|
188
|
+
"V Align": "Boven uitlijnen",
|
189
|
+
"Header": "Koptekst",
|
190
|
+
"Right": "Rechts",
|
191
|
+
"Insert column after": "Voeg kolom in na",
|
192
|
+
"Cols": "Kolommen",
|
193
|
+
"Insert row after": "Voeg rij onder toe",
|
194
|
+
"Width": "Breedte",
|
195
|
+
"Cell properties": "Cel eigenschappen",
|
196
|
+
"Left": "Links",
|
197
|
+
"Cut row": "Knip rij",
|
198
|
+
"Delete column": "Verwijder kolom",
|
199
|
+
"Center": "Midden",
|
200
|
+
"Merge cells": "Cellen samenvoegen",
|
201
|
+
"Insert template": "Sjabloon invoegen",
|
202
|
+
"Templates": "Sjablonen",
|
203
|
+
"Background color": "Achtergrondkleur",
|
204
|
+
"Custom...": "Eigen...",
|
205
|
+
"Custom color": "Eigen kleur",
|
206
|
+
"No color": "Geen kleur",
|
207
|
+
"Text color": "Tekstkleur",
|
208
|
+
"Show blocks": "Blokken tonen",
|
209
|
+
"Show invisible characters": "Onzichtbare karakters tonen",
|
210
|
+
"Words: {0}": "Woorden: {0}",
|
211
|
+
"Insert": "Invoegen",
|
212
|
+
"File": "Bestand",
|
213
|
+
"Edit": "Bewerken",
|
214
|
+
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Rich Text Area. Druk ALT-F9 voor het menu. Druk ALT-F10 voor de toolbar. Druk ALT-0 voor help.",
|
215
|
+
"Tools": "Gereedschap",
|
216
|
+
"View": "Beeld",
|
217
|
+
"Table": "Tabel",
|
218
|
+
"Format": "Opmaak"
|
219
|
+
});
|
@@ -1,28 +1,46 @@
|
|
1
|
-
window["cama_init_media"] = (media_panel)->
|
1
|
+
window["cama_init_media"] = (media_panel) ->
|
2
2
|
media_info = media_panel.find(".media_file_info")
|
3
3
|
media_info_tab_info = media_panel.find(".media_file_info_col .nav-tabs .link_media_info")
|
4
4
|
media_link_tab_upload = media_panel.find(".media_file_info_col .nav-tabs .link_media_upload")
|
5
5
|
|
6
6
|
################ visualize item
|
7
7
|
show_file = (item) ->
|
8
|
+
item.addClass('selected').siblings().removeClass('selected')
|
8
9
|
data = eval("("+item.find(".data_value").val()+")")
|
9
10
|
media_info_tab_info.click()
|
10
11
|
tpl =
|
11
12
|
"<div class='p_thumb'></div>" +
|
12
|
-
|
13
|
-
|
13
|
+
"<div class='p_label'><b>"+I18n("button.name")+": </b><br> <span>"+data["name"]+"</span></div>" +
|
14
|
+
"<div class='p_body'>" +
|
14
15
|
"<div><b>"+I18n("button.url")+":</b><br> <a target='_blank' href='"+data["url"]+"'>"+data["url"]+"</a></div>" +
|
15
16
|
"<div><b>"+I18n("button.size")+":</b><br> <span>"+data["size"]+"</span></div>" +
|
16
|
-
|
17
|
+
"</div>"
|
17
18
|
|
18
19
|
if window["callback_media_uploader"]
|
19
|
-
if !media_panel.attr("data-formats") || (media_panel.attr("data-formats") && $.inArray(data["format"], media_panel.attr("data-formats").split(",")) >= 0)
|
20
|
+
if !media_panel.attr("data-formats") || (media_panel.attr("data-formats") && ($.inArray(data["format"], media_panel.attr("data-formats").split(",")) >= 0 || $.inArray(data["url"].split(".").pop().toLowerCase(), media_panel.attr("data-formats").split(",")) >= 0))
|
20
21
|
tpl += "<div class='p_footer'>" +
|
21
|
-
|
22
|
-
|
22
|
+
"<button class='btn btn-primary insert_btn'>"+I18n("button.insert")+"</button>" +
|
23
|
+
"</div>"
|
23
24
|
|
24
25
|
media_info.html(tpl)
|
25
26
|
media_info.find(".p_thumb").html(item.find(".thumb").html())
|
27
|
+
if data["format"] == "image" && media_panel.attr("data-dimension") # verify dimensions
|
28
|
+
img = $('<img src="'+data["url"]+'">').hide()
|
29
|
+
btn = media_info.append(img).find(".p_footer .insert_btn")
|
30
|
+
btn.prop('disabled', true)
|
31
|
+
img.load ->
|
32
|
+
media_info.find(".p_body").append("<div class='cdimension'><b>"+I18n("button.dimension")+": </b><span>"+this.width+"x"+this.height+"</span></div>")
|
33
|
+
ww = parseInt(media_panel.attr("data-dimension").split("x")[0]) || this.width
|
34
|
+
hh = parseInt(media_panel.attr("data-dimension").split("x")[1]) || this.height
|
35
|
+
if media_panel.attr("data-dimension") && this.width == ww && this.height == hh
|
36
|
+
btn.prop('disabled', false)
|
37
|
+
else
|
38
|
+
media_info.find(".cdimension").css("color", 'red')
|
39
|
+
cut = $("<button class='btn btn-info pull-right'><i class='fa fa-crop'></i> "+I18n("button.crop_image")+"</button>").click(->
|
40
|
+
$.fn.upload_url({url: data["url"]})
|
41
|
+
)
|
42
|
+
btn.after(cut)
|
43
|
+
media_info.find(".p_thumb").html(img.show())
|
26
44
|
|
27
45
|
if window["callback_media_uploader"] # trigger callback
|
28
46
|
media_info.find(".insert_btn").click ->
|
@@ -41,21 +59,24 @@ window["cama_init_media"] = (media_panel)->
|
|
41
59
|
########## file uploader
|
42
60
|
p_upload = media_panel.find(".cama_media_fileuploader")
|
43
61
|
customFileData = ->
|
44
|
-
return {folder: media_panel.attr("data-folder") }
|
62
|
+
return {folder: media_panel.attr("data-folder"), formats: media_panel.attr("data-formats") }
|
45
63
|
|
46
64
|
p_upload.uploadFile({
|
47
65
|
url: p_upload.attr("data-url"),
|
48
66
|
fileName: "file_upload",
|
67
|
+
dragDropStr: '<span><b>'+p_upload.attr('data-dragDropStr')+'</b></span>',
|
68
|
+
uploadStr: p_upload.attr('data-uploadStr'),
|
49
69
|
dynamicFormData: customFileData,
|
50
|
-
onSuccess: (files,res_upload,xhr,pd)->
|
70
|
+
onSuccess: ((files,res_upload,xhr,pd)->
|
51
71
|
if res_upload.search("<") == 0 # success upload
|
52
|
-
|
53
|
-
if $(pd.statusbar).siblings().length == 0
|
54
|
-
p.children().first().click()
|
72
|
+
media_panel.trigger("add_file", {item: res_upload, selected: $(pd.statusbar).siblings().not('.error_file_upload').size() == 0})
|
55
73
|
$(pd.statusbar).remove();
|
56
|
-
|
57
74
|
else
|
58
75
|
$(pd.statusbar).find(".ajax-file-upload-progress").html("<span style='color: red;'>"+res_upload+"</span>");
|
76
|
+
),
|
77
|
+
onError: ((files,status,errMsg,pd) ->
|
78
|
+
$(pd.statusbar).addClass('error_file_upload').find(".ajax-file-upload-filename").append(" <i class='fa fa-times btn btn-danger btn-xs' onclick='$(this).closest(\".ajax-file-upload-statusbar\").remove();'></i>")
|
79
|
+
)
|
59
80
|
})
|
60
81
|
## end file uploader
|
61
82
|
|
@@ -101,14 +122,19 @@ window["cama_init_media"] = (media_panel)->
|
|
101
122
|
media_panel.find(".media_browser_list").html(res)
|
102
123
|
hideLoading()
|
103
124
|
)
|
125
|
+
).bind("add_file", (e, data)-> # add html item in the list
|
126
|
+
item = $(data["item"])
|
127
|
+
media_panel.find(".media_browser_list").prepend(item)
|
128
|
+
if data["selected"] == true || data["selected"] == undefined
|
129
|
+
item.click()
|
104
130
|
)
|
105
131
|
|
106
132
|
|
107
133
|
# element actions
|
108
134
|
media_panel.on("click", "a.add_folder", ->
|
109
|
-
content = $("<form><div><label for=''>
|
135
|
+
content = $("<form><div><label for=''>"+I18n('button.folder')+": </label> <div class='input-group'><input name='folder' class='form-control required' placeholder='Folder name..'><span class='input-group-btn'><button class='btn btn-primary' type='submit'>"+I18n('button.create')+"</button></span></div></div> </form>")
|
110
136
|
callback = (modal)->
|
111
|
-
btn = modal.find("
|
137
|
+
btn = modal.find(".btn-primary")
|
112
138
|
input = modal.find("input").keyup(->
|
113
139
|
if $(this).val()
|
114
140
|
btn.removeAttr("disabled")
|
@@ -129,6 +155,7 @@ window["cama_init_media"] = (media_panel)->
|
|
129
155
|
open_modal({title: "New Folder", content: content, callback: callback})
|
130
156
|
return false
|
131
157
|
)
|
158
|
+
|
132
159
|
# destroy file and folder
|
133
160
|
media_panel.on("click", "a.del_item, a.del_folder", ->
|
134
161
|
unless confirm(I18n("msg.delete_item"))
|
@@ -139,23 +166,59 @@ window["cama_init_media"] = (media_panel)->
|
|
139
166
|
$.post(media_panel.attr("data-url_actions"), {folder: media_panel.attr("data-folder")+"/"+item.attr("data-key"), media_action: if link.hasClass("del_folder") then "del_folder" else "del_file"}, (res)->
|
140
167
|
hideLoading()
|
141
168
|
if res
|
142
|
-
$.fn.alert({type: 'error', content: res, title: "
|
169
|
+
$.fn.alert({type: 'error', content: res, title: I18n("button.error")})
|
143
170
|
else
|
144
171
|
item.remove()
|
145
172
|
media_info.html("")
|
173
|
+
).error(->
|
174
|
+
$.fn.alert({type: 'error', content: I18n("msg.internal_error"), title: I18n("button.error")})
|
146
175
|
)
|
147
176
|
return false
|
148
177
|
)
|
149
178
|
|
179
|
+
# upload from url form
|
180
|
+
media_panel.find("#cama_media_external").submit( ->
|
181
|
+
unless $(this).valid()
|
182
|
+
return false
|
183
|
+
$.fn.upload_url({url: $(this).find("input").val(), callback: ->
|
184
|
+
media_panel.find("#cama_media_external")[0].reset();
|
185
|
+
})
|
186
|
+
return false
|
187
|
+
).validate()
|
188
|
+
|
189
|
+
$ ->
|
190
|
+
# sample: $.fn.upload_url({url: 'http://camaleon.tuzitio.com/media/132/logo2.png', dimension: '120x120', folder: 'my_folder'})
|
191
|
+
# dimension: default current dimension
|
192
|
+
# folder: default current folder
|
193
|
+
$.fn.upload_url = (args)->
|
194
|
+
media_panel = $("#cama_media_gallery")
|
195
|
+
data = {folder: media_panel.attr("data-folder"), media_action: "crop_url", formats: media_panel.attr("data-formats"), onerror: (message) ->
|
196
|
+
$.fn.alert({type: 'error', content: message, title: I18n("msg.error_uploading")})
|
197
|
+
}
|
198
|
+
$.extend(data, args); on_error = data["onerror"]; delete data["onerror"];
|
199
|
+
showLoading()
|
200
|
+
$.post(media_panel.attr("data-url_actions"), data, (res_upload)->
|
201
|
+
hideLoading()
|
202
|
+
if res_upload.search("<") == 0 # success upload
|
203
|
+
media_panel.trigger("add_file", {item: res_upload})
|
204
|
+
if data["callback"]
|
205
|
+
data["callback"](res_upload)
|
206
|
+
else
|
207
|
+
$.fn.alert({type: 'error', content: res_upload, title: I18n("button.error")})
|
208
|
+
).error(->
|
209
|
+
$.fn.alert({type: 'error', content: I18n("msg.internal_error"), title: I18n("button.error")})
|
210
|
+
)
|
211
|
+
|
150
212
|
|
151
213
|
# jquery library for modal updaloder
|
152
214
|
$ ->
|
153
|
-
# sample: $.fn.upload_filemanager({title: "My title", formats: "image,video", selected: function(file){ alert(file["name"]) }})
|
215
|
+
# sample: $.fn.upload_filemanager({title: "My title", formats: "image,video", dimension: "30x30", selected: function(file){ alert(file["name"]) }})
|
154
216
|
# file structure: {"name":"422.html","size":1547, "url":"http://localhost:3000/media/1/422.html", "format":"doc","type":"text/html"}
|
217
|
+
# dimension: dimension: "30x30" | "x30" | dimension: "30x"
|
155
218
|
$.fn.upload_filemanager = (args)->
|
156
219
|
args = args || {}
|
157
|
-
open_modal({title: args["title"] || I18n("msg.media_title"), modal_size: "modal-lg", mode: "ajax", url: root_url+"/admin/media/ajax", ajax_params: {media_formats: args["formats"]}, callback: (modal)->
|
220
|
+
open_modal({title: args["title"] || I18n("msg.media_title"), id: 'cama_modal_file_uploader', modal_size: "modal-lg", mode: "ajax", url: root_url+"/admin/media/ajax", ajax_params: {media_formats: args["formats"], dimension: args["dimension"] }, callback: (modal)->
|
158
221
|
if args["selected"]
|
159
222
|
window["callback_media_uploader"] = args["selected"]
|
160
223
|
modal.css("z-index", args["zindex"] || 99999).children(".modal-dialog").css("width", "90%")
|
161
|
-
})
|
224
|
+
})
|