tramway 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/MIT-LICENSE +20 -0
- data/README.md +889 -15
- data/Rakefile +8 -8
- data/app/assets/config/tramway_core_manifest.js +2 -0
- data/app/assets/images/tramway/mona_lisa_from_prado.jpg +0 -0
- data/app/assets/images/tramway/mona_lisa_from_prado_square.jpg +0 -0
- data/app/assets/javascripts/bootstrap-datepicker-1.8.0.js +2035 -0
- data/app/assets/javascripts/bootstrap-datepicker-1.8.0.ru.min.js +64 -0
- data/app/assets/javascripts/ckeditor/config.js +30 -0
- data/app/assets/javascripts/ckeditor/plugins/image/dialogs/image.js +1259 -0
- data/app/assets/javascripts/ckeditor/plugins/image/icons/hidpi/image.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/image/icons/image.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/image/images/noimage.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/image/lang/en.js +25 -0
- data/app/assets/javascripts/ckeditor/plugins/image/lang/ru.js +25 -0
- data/app/assets/javascripts/ckeditor/plugins/image/plugin.js +184 -0
- data/app/assets/javascripts/ckeditor/plugins/youtube/images/icon-hdpi.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/youtube/images/icon.png +0 -0
- data/app/assets/javascripts/ckeditor/plugins/youtube/lang/en.js +25 -0
- data/app/assets/javascripts/ckeditor/plugins/youtube/lang/ru.js +25 -0
- data/app/assets/javascripts/ckeditor/plugins/youtube/plugin.js +449 -0
- data/app/assets/javascripts/tramway/application.js +60 -0
- data/app/assets/stylesheets/tramway/application.sass +60 -0
- data/app/assets/stylesheets/tramway/bootstrap-datepicker-1.8.0.css +477 -0
- data/app/controllers/concerns/auth_management.rb +26 -0
- data/app/controllers/concerns/filtering.rb +43 -0
- data/app/controllers/tramway/application_controller.rb +142 -0
- data/app/controllers/tramway/export/application_controller.rb +5 -0
- data/app/controllers/tramway/has_and_belongs_to_many_records_controller.rb +26 -0
- data/app/controllers/tramway/records_controller.rb +86 -0
- data/app/controllers/tramway/sessions_controller.rb +49 -0
- data/app/controllers/tramway/singletons_controller.rb +48 -0
- data/app/controllers/tramway/welcome_controller.rb +17 -0
- data/app/decorators/tramway/application_decorated_collection.rb +15 -0
- data/app/decorators/tramway/application_decorator.rb +124 -0
- data/app/decorators/tramway/associations/class_helper.rb +45 -0
- data/app/decorators/tramway/associations/object_helper.rb +58 -0
- data/app/decorators/tramway/attributes/view_helper.rb +30 -0
- data/app/decorators/tramway/concerns/attributes_decorator_helper.rb +97 -0
- data/app/decorators/tramway/concerns/table_builder.rb +33 -0
- data/app/decorators/tramway/default/values_helper.rb +23 -0
- data/app/decorators/tramway/delegating/class_helper.rb +9 -0
- data/app/decorators/tramway/user_decorator.rb +49 -0
- data/app/forms/admin/tramway/user_form.rb +24 -0
- data/app/forms/tramway/application_form.rb +124 -0
- data/app/forms/tramway/application_forms/association_class_helpers.rb +7 -0
- data/app/forms/tramway/application_forms/association_object_helpers.rb +36 -0
- data/app/forms/tramway/application_forms/constant_class_actions.rb +7 -0
- data/app/forms/tramway/application_forms/constant_object_actions.rb +20 -0
- data/app/forms/tramway/application_forms/frontend.rb +12 -0
- data/app/forms/tramway/application_forms/object_helpers.rb +15 -0
- data/app/forms/tramway/application_forms/properties_object_helper.rb +16 -0
- data/app/forms/tramway/application_forms/submit_helper.rb +26 -0
- data/app/forms/tramway/extendable_form.rb +15 -0
- data/app/forms/tramway/extendable_forms_helpers/class_builder.rb +34 -0
- data/app/forms/tramway/extendable_forms_helpers/ignored_properties_helper.rb +11 -0
- data/app/forms/tramway/extendable_forms_helpers/more_properties_helper.rb +31 -0
- data/app/forms/tramway/extendable_forms_helpers/properties_helper.rb +16 -0
- data/app/forms/tramway/extendable_forms_helpers/submit/class_helpers.rb +18 -0
- data/app/forms/tramway/extendable_forms_helpers/submit/object_helpers.rb +21 -0
- data/app/forms/tramway/extendable_forms_helpers/validators.rb +40 -0
- data/app/forms/tramway/extended_application_form.rb +23 -0
- data/app/forms/tramway/form_creator.rb +7 -0
- data/app/forms/tramway/session_form.rb +26 -0
- data/app/helpers/tramway/actions_helper.rb +45 -0
- data/app/helpers/tramway/additional_buttons_builder.rb +12 -0
- data/app/helpers/tramway/application_helper.rb +27 -0
- data/app/helpers/tramway/cases_helper.rb +13 -0
- data/app/helpers/tramway/copy_to_clipboard_helper.rb +11 -0
- data/app/helpers/tramway/focus_generator_helper.rb +10 -0
- data/app/helpers/tramway/frontend_helper.rb +26 -0
- data/app/helpers/tramway/inputs/associations_helper.rb +30 -0
- data/app/helpers/tramway/inputs/polymorphic_associations_helper.rb +24 -0
- data/app/helpers/tramway/inputs_helper.rb +96 -0
- data/app/helpers/tramway/model_helper.rb +7 -0
- data/app/helpers/tramway/navbar_helper.rb +11 -0
- data/app/helpers/tramway/records_helper.rb +120 -0
- data/app/helpers/tramway/russian_cases_helper.rb +26 -0
- data/app/helpers/tramway/singleton_helper.rb +12 -0
- data/app/helpers/tramway/state_machine_buttons_helper.rb +61 -0
- data/app/helpers/tramway/title_helper.rb +25 -0
- data/app/inputs/date_picker_input.rb +4 -0
- data/app/inputs/multiple_file_input.rb +7 -0
- data/app/models/tramway/application_record.rb +60 -0
- data/app/models/tramway/user.rb +23 -0
- data/app/uploaders/application_uploader.rb +22 -0
- data/app/uploaders/file_uploader.rb +4 -0
- data/app/uploaders/ico_uploader.rb +7 -0
- data/app/uploaders/image_defaults.rb +14 -0
- data/app/uploaders/photo_uploader.rb +54 -0
- data/app/views/layouts/tramway/application.html.haml +32 -0
- data/app/views/layouts/tramway/shared/_navbar.html.haml +46 -0
- data/app/views/tramway/404.haml +1 -0
- data/app/views/tramway/records/_form.html.haml +22 -0
- data/app/views/tramway/records/_list.html.haml +38 -0
- data/app/views/tramway/records/_search.html.haml +34 -0
- data/app/views/tramway/records/edit.html.haml +1 -0
- data/app/views/tramway/records/index.html.haml +31 -0
- data/app/views/tramway/records/new.html.haml +1 -0
- data/app/views/tramway/records/show.html.haml +1 -0
- data/app/views/tramway/sessions/new.html.haml +9 -0
- data/app/views/tramway/shared/_input.html.haml +34 -0
- data/app/views/tramway/shared/_input_extended.html.haml +14 -0
- data/app/views/tramway/shared/_messages.html.haml +10 -0
- data/app/views/tramway/shared/_show.html.haml +35 -0
- data/app/views/tramway/shared/errors/server_error.html.haml +12 -0
- data/app/views/tramway/shared/input_extended_types/_checkbox.html.haml +1 -0
- data/app/views/tramway/shared/input_extended_types/_select.html.haml +16 -0
- data/app/views/tramway/shared/input_extended_types/_simple.html.haml +4 -0
- data/app/views/tramway/shared/input_extended_types/_yes_no.html.haml +4 -0
- data/app/views/tramway/shared/show/_attribute_tr.html.haml +9 -0
- data/app/views/tramway/shared/show/associations/_habtm_row.html.haml +14 -0
- data/app/views/tramway/shared/show/associations/_list.html.haml +21 -0
- data/app/views/tramway/shared/show/associations/_row.html.haml +19 -0
- data/app/views/tramway/shared/show/associations/_table_row.html.haml +21 -0
- data/app/views/tramway/singletons/_form.html.haml +15 -0
- data/app/views/tramway/singletons/edit.html.haml +1 -0
- data/app/views/tramway/singletons/new.html.haml +1 -0
- data/app/views/tramway/singletons/show.html.haml +1 -0
- data/app/views/tramway/welcome/index.html.haml +4 -0
- data/config/initializers/assets.rb +7 -0
- data/config/initializers/carrierwave.rb +5 -0
- data/config/initializers/ckeditor.rb +9 -0
- data/config/initializers/plurals.rb +25 -0
- data/config/locales/en/collections.yml +4 -0
- data/config/locales/en/date.yml +16 -0
- data/config/locales/en/dates.yml +10 -0
- data/config/locales/en/helpers.yml +26 -0
- data/config/locales/en/locale.yml +11 -0
- data/config/locales/en/messages.yml +7 -0
- data/config/locales/en/models.yml +9 -0
- data/config/locales/en/simple_form_extension.yml +8 -0
- data/config/locales/en/state_machines.yml +8 -0
- data/config/locales/ru/collections.yml +4 -0
- data/config/locales/ru/date.yml +16 -0
- data/config/locales/ru/dates.yml +10 -0
- data/config/locales/ru/helpers.yml +30 -0
- data/config/locales/ru/locale.yml +6 -0
- data/config/locales/ru/messages.yml +7 -0
- data/config/locales/ru/models.yml +21 -0
- data/config/locales/ru/simple_form_extension.yml +8 -0
- data/config/locales/ru/state_machines.yml +8 -0
- data/config/routes.rb +13 -0
- data/lib/string.rb +18 -0
- data/lib/tramway/application.rb +10 -0
- data/lib/tramway/class_name_helpers.rb +15 -0
- data/lib/tramway/collection.rb +9 -0
- data/lib/tramway/collections/helper.rb +21 -0
- data/lib/tramway/collections.rb +4 -0
- data/lib/tramway/engine.rb +14 -0
- data/lib/tramway/error.rb +32 -0
- data/lib/tramway/forms.rb +5 -0
- data/lib/tramway/generators/install_generator.rb +49 -0
- data/lib/tramway/generators/model_generator.rb +105 -0
- data/lib/tramway/generators/templates/create_tramway_users.rb +18 -0
- data/lib/tramway/generators/templates/decorator.rb.erb +56 -0
- data/lib/tramway/generators/templates/form.rb.erb +22 -0
- data/lib/tramway/generators/templates/initializers/simple_form.rb +23 -0
- data/lib/tramway/generators/templates/initializers/simple_form_bootstrap.rb +133 -0
- data/lib/tramway/generators.rb +4 -0
- data/lib/tramway/navbar.rb +44 -0
- data/lib/tramway/notifications.rb +12 -0
- data/lib/tramway/record_routes_helper.rb +23 -0
- data/lib/tramway/records_models.rb +52 -0
- data/lib/tramway/singleton_models.rb +32 -0
- data/lib/tramway/spec/helpers/navbar_helper.rb +7 -0
- data/lib/tramway/spec/helpers/tramway_helpers.rb +47 -0
- data/lib/tramway/version.rb +3 -1
- data/lib/tramway/welcome_page_actions.rb +5 -0
- data/lib/tramway/yaml/errors.yml +49 -0
- data/lib/tramway.rb +143 -2
- data/lib/validators/presence_validator.rb +9 -0
- metadata +582 -25
- data/.gitignore +0 -9
- data/.travis.yml +0 -5
- data/Gemfile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/tramway.gemspec +0 -26
@@ -0,0 +1,449 @@
|
|
1
|
+
/*
|
2
|
+
* Youtube Embed Plugin
|
3
|
+
*
|
4
|
+
* @author Jonnas Fonini <jonnasfonini@gmail.com>
|
5
|
+
* @version 2.1.14
|
6
|
+
*/
|
7
|
+
(function () {
|
8
|
+
CKEDITOR.plugins.add('youtube', {
|
9
|
+
lang: [ 'en', 'bg', 'pt', 'pt-br', 'ja', 'hu', 'it', 'fr', 'tr', 'ru', 'de', 'ar', 'nl', 'pl', 'vi', 'zh', 'el', 'he', 'es', 'nb', 'nn', 'fi', 'et', 'sk', 'cs', 'ko', 'eu', 'uk'],
|
10
|
+
init: function (editor) {
|
11
|
+
editor.addCommand('youtube', new CKEDITOR.dialogCommand('youtube', {
|
12
|
+
allowedContent: 'div{*}(*); iframe{*}[!width,!height,!src,!frameborder,!allowfullscreen,!allow]; object param[*]; a[*]; img[*]'
|
13
|
+
}));
|
14
|
+
|
15
|
+
editor.ui.addButton('Youtube', {
|
16
|
+
label : editor.lang.youtube.button,
|
17
|
+
toolbar : 'insert',
|
18
|
+
command : 'youtube',
|
19
|
+
icon : this.path + 'images/icon.png'
|
20
|
+
});
|
21
|
+
|
22
|
+
CKEDITOR.dialog.add('youtube', function (instance) {
|
23
|
+
var video,
|
24
|
+
disabled = editor.config.youtube_disabled_fields || [];
|
25
|
+
|
26
|
+
return {
|
27
|
+
title : editor.lang.youtube.title,
|
28
|
+
minWidth : 510,
|
29
|
+
minHeight : 200,
|
30
|
+
onShow: function () {
|
31
|
+
for (var i = 0; i < disabled.length; i++) {
|
32
|
+
this.getContentElement('youtubePlugin', disabled[i]).disable();
|
33
|
+
}
|
34
|
+
},
|
35
|
+
contents :
|
36
|
+
[{
|
37
|
+
id : 'youtubePlugin',
|
38
|
+
expand : true,
|
39
|
+
elements :
|
40
|
+
[{
|
41
|
+
id : 'txtEmbed',
|
42
|
+
type : 'textarea',
|
43
|
+
label : editor.lang.youtube.txtEmbed,
|
44
|
+
onChange : function (api) {
|
45
|
+
handleEmbedChange(this, api);
|
46
|
+
},
|
47
|
+
onKeyUp : function (api) {
|
48
|
+
handleEmbedChange(this, api);
|
49
|
+
},
|
50
|
+
validate : function () {
|
51
|
+
if (this.isEnabled()) {
|
52
|
+
if (!this.getValue()) {
|
53
|
+
alert(editor.lang.youtube.noCode);
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
else
|
57
|
+
if (this.getValue().length === 0 || this.getValue().indexOf('//') === -1) {
|
58
|
+
alert(editor.lang.youtube.invalidEmbed);
|
59
|
+
return false;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
{
|
65
|
+
type : 'html',
|
66
|
+
html : editor.lang.youtube.or + '<hr>'
|
67
|
+
},
|
68
|
+
{
|
69
|
+
type : 'hbox',
|
70
|
+
widths : [ '70%', '15%', '15%' ],
|
71
|
+
children :
|
72
|
+
[
|
73
|
+
{
|
74
|
+
id : 'txtUrl',
|
75
|
+
type : 'text',
|
76
|
+
label : editor.lang.youtube.txtUrl,
|
77
|
+
onChange : function (api) {
|
78
|
+
handleLinkChange(this, api);
|
79
|
+
},
|
80
|
+
onKeyUp : function (api) {
|
81
|
+
handleLinkChange(this, api);
|
82
|
+
},
|
83
|
+
validate : function () {
|
84
|
+
if (this.isEnabled()) {
|
85
|
+
if (!this.getValue()) {
|
86
|
+
alert(editor.lang.youtube.noCode);
|
87
|
+
return false;
|
88
|
+
}
|
89
|
+
else{
|
90
|
+
video = ytVidId(this.getValue());
|
91
|
+
|
92
|
+
if (this.getValue().length === 0 || video === false)
|
93
|
+
{
|
94
|
+
alert(editor.lang.youtube.invalidUrl);
|
95
|
+
return false;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
},
|
101
|
+
{
|
102
|
+
type : 'text',
|
103
|
+
id : 'txtWidth',
|
104
|
+
width : '60px',
|
105
|
+
label : editor.lang.youtube.txtWidth,
|
106
|
+
'default' : editor.config.youtube_width != null ? editor.config.youtube_width : '640',
|
107
|
+
validate : function () {
|
108
|
+
if (this.getValue()) {
|
109
|
+
var width = parseInt (this.getValue()) || 0;
|
110
|
+
|
111
|
+
if (width === 0) {
|
112
|
+
alert(editor.lang.youtube.invalidWidth);
|
113
|
+
return false;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
else {
|
117
|
+
alert(editor.lang.youtube.noWidth);
|
118
|
+
return false;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
},
|
122
|
+
{
|
123
|
+
type : 'text',
|
124
|
+
id : 'txtHeight',
|
125
|
+
width : '60px',
|
126
|
+
label : editor.lang.youtube.txtHeight,
|
127
|
+
'default' : editor.config.youtube_height != null ? editor.config.youtube_height : '360',
|
128
|
+
validate : function () {
|
129
|
+
if (this.getValue()) {
|
130
|
+
var height = parseInt(this.getValue()) || 0;
|
131
|
+
|
132
|
+
if (height === 0) {
|
133
|
+
alert(editor.lang.youtube.invalidHeight);
|
134
|
+
return false;
|
135
|
+
}
|
136
|
+
}
|
137
|
+
else {
|
138
|
+
alert(editor.lang.youtube.noHeight);
|
139
|
+
return false;
|
140
|
+
}
|
141
|
+
}
|
142
|
+
}
|
143
|
+
]
|
144
|
+
},
|
145
|
+
{
|
146
|
+
type : 'hbox',
|
147
|
+
widths : [ '55%', '45%' ],
|
148
|
+
children :
|
149
|
+
[
|
150
|
+
{
|
151
|
+
id : 'chkResponsive',
|
152
|
+
type : 'checkbox',
|
153
|
+
label : editor.lang.youtube.txtResponsive,
|
154
|
+
'default' : editor.config.youtube_responsive != null ? editor.config.youtube_responsive : false
|
155
|
+
},
|
156
|
+
{
|
157
|
+
id : 'chkNoEmbed',
|
158
|
+
type : 'checkbox',
|
159
|
+
label : editor.lang.youtube.txtNoEmbed,
|
160
|
+
'default' : editor.config.youtube_noembed != null ? editor.config.youtube_noembed : false
|
161
|
+
}
|
162
|
+
]
|
163
|
+
},
|
164
|
+
{
|
165
|
+
type : 'hbox',
|
166
|
+
widths : [ '55%', '45%' ],
|
167
|
+
children :
|
168
|
+
[
|
169
|
+
{
|
170
|
+
id : 'chkRelated',
|
171
|
+
type : 'checkbox',
|
172
|
+
'default' : editor.config.youtube_related != null ? editor.config.youtube_related : true,
|
173
|
+
label : editor.lang.youtube.chkRelated
|
174
|
+
},
|
175
|
+
{
|
176
|
+
id : 'chkOlderCode',
|
177
|
+
type : 'checkbox',
|
178
|
+
'default' : editor.config.youtube_older != null ? editor.config.youtube_older : false,
|
179
|
+
label : editor.lang.youtube.chkOlderCode
|
180
|
+
}
|
181
|
+
]
|
182
|
+
},
|
183
|
+
{
|
184
|
+
type : 'hbox',
|
185
|
+
widths : [ '55%', '45%' ],
|
186
|
+
children :
|
187
|
+
[
|
188
|
+
{
|
189
|
+
id : 'chkPrivacy',
|
190
|
+
type : 'checkbox',
|
191
|
+
label : editor.lang.youtube.chkPrivacy,
|
192
|
+
'default' : editor.config.youtube_privacy != null ? editor.config.youtube_privacy : false
|
193
|
+
},
|
194
|
+
{
|
195
|
+
id : 'chkAutoplay',
|
196
|
+
type : 'checkbox',
|
197
|
+
'default' : editor.config.youtube_autoplay != null ? editor.config.youtube_autoplay : false,
|
198
|
+
label : editor.lang.youtube.chkAutoplay
|
199
|
+
}
|
200
|
+
]
|
201
|
+
},
|
202
|
+
{
|
203
|
+
type : 'hbox',
|
204
|
+
widths : [ '55%', '45%'],
|
205
|
+
children :
|
206
|
+
[
|
207
|
+
{
|
208
|
+
id : 'txtStartAt',
|
209
|
+
type : 'text',
|
210
|
+
label : editor.lang.youtube.txtStartAt,
|
211
|
+
validate : function () {
|
212
|
+
if (this.getValue()) {
|
213
|
+
var str = this.getValue();
|
214
|
+
|
215
|
+
if (!/^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$/i.test(str)) {
|
216
|
+
alert(editor.lang.youtube.invalidTime);
|
217
|
+
return false;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
},
|
222
|
+
{
|
223
|
+
id : 'chkControls',
|
224
|
+
type : 'checkbox',
|
225
|
+
'default' : editor.config.youtube_controls != null ? editor.config.youtube_controls : true,
|
226
|
+
label : editor.lang.youtube.chkControls
|
227
|
+
}
|
228
|
+
]
|
229
|
+
}
|
230
|
+
]
|
231
|
+
}
|
232
|
+
],
|
233
|
+
onOk: function()
|
234
|
+
{
|
235
|
+
var content = '';
|
236
|
+
var responsiveStyle = '';
|
237
|
+
|
238
|
+
if (this.getContentElement('youtubePlugin', 'txtEmbed').isEnabled()) {
|
239
|
+
content = this.getValueOf('youtubePlugin', 'txtEmbed');
|
240
|
+
}
|
241
|
+
else {
|
242
|
+
var url = 'https://', params = [], startSecs, paramAutoplay='';
|
243
|
+
var width = this.getValueOf('youtubePlugin', 'txtWidth');
|
244
|
+
var height = this.getValueOf('youtubePlugin', 'txtHeight');
|
245
|
+
|
246
|
+
if (this.getContentElement('youtubePlugin', 'chkPrivacy').getValue() === true) {
|
247
|
+
url += 'www.youtube-nocookie.com/';
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
url += 'www.youtube.com/';
|
251
|
+
}
|
252
|
+
|
253
|
+
url += 'embed/' + video;
|
254
|
+
|
255
|
+
if (this.getContentElement('youtubePlugin', 'chkRelated').getValue() === false) {
|
256
|
+
params.push('rel=0');
|
257
|
+
}
|
258
|
+
|
259
|
+
if (this.getContentElement('youtubePlugin', 'chkAutoplay').getValue() === true) {
|
260
|
+
params.push('autoplay=1');
|
261
|
+
paramAutoplay='autoplay';
|
262
|
+
}
|
263
|
+
|
264
|
+
if (this.getContentElement('youtubePlugin', 'chkControls').getValue() === false) {
|
265
|
+
params.push('controls=0');
|
266
|
+
}
|
267
|
+
|
268
|
+
startSecs = this.getValueOf('youtubePlugin', 'txtStartAt');
|
269
|
+
|
270
|
+
if (startSecs) {
|
271
|
+
var seconds = hmsToSeconds(startSecs);
|
272
|
+
|
273
|
+
params.push('start=' + seconds);
|
274
|
+
}
|
275
|
+
|
276
|
+
if (params.length > 0) {
|
277
|
+
url = url + '?' + params.join('&');
|
278
|
+
}
|
279
|
+
|
280
|
+
if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
|
281
|
+
content += '<div class="youtube-embed-wrapper" style="position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden">';
|
282
|
+
responsiveStyle = 'style="position:absolute;top:0;left:0;width:100%;height:100%"';
|
283
|
+
}
|
284
|
+
|
285
|
+
if (this.getContentElement('youtubePlugin', 'chkOlderCode').getValue() === true) {
|
286
|
+
url = url.replace('embed/', 'v/');
|
287
|
+
url = url.replace(/&/g, '&');
|
288
|
+
|
289
|
+
if (url.indexOf('?') === -1) {
|
290
|
+
url += '?';
|
291
|
+
}
|
292
|
+
else {
|
293
|
+
url += '&';
|
294
|
+
}
|
295
|
+
url += 'hl=' + (this.getParentEditor().config.language ? this.getParentEditor().config.language : 'en') + '&version=3';
|
296
|
+
|
297
|
+
content += '<object width="' + width + '" height="' + height + '" ' + responsiveStyle + '>';
|
298
|
+
content += '<param name="movie" value="' + url + '"></param>';
|
299
|
+
content += '<param name="allowFullScreen" value="true"></param>';
|
300
|
+
content += '<param name="allowscriptaccess" value="always"></param>';
|
301
|
+
content += '<embed src="' + url + '" type="application/x-shockwave-flash" ';
|
302
|
+
content += 'width="' + width + '" height="' + height + '" '+ responsiveStyle + ' allowscriptaccess="always" ';
|
303
|
+
content += 'allowfullscreen="true"></embed>';
|
304
|
+
content += '</object>';
|
305
|
+
}
|
306
|
+
else
|
307
|
+
if (this.getContentElement('youtubePlugin', 'chkNoEmbed').getValue() === true) {
|
308
|
+
var imgSrc = 'https://img.youtube.com/vi/' + video + '/sddefault.jpg';
|
309
|
+
content += '<a href="' + url + '" ><img width="' + width + '" height="' + height + '" src="' + imgSrc + '" ' + responsiveStyle + '/></a>';
|
310
|
+
}
|
311
|
+
else {
|
312
|
+
content += '<iframe ' + (paramAutoplay ? 'allow="' + paramAutoplay + ';" ' : '') + 'width="' + width + '" height="' + height + '" src="' + url + '" ' + responsiveStyle;
|
313
|
+
content += 'frameborder="0" allowfullscreen></iframe>';
|
314
|
+
}
|
315
|
+
|
316
|
+
if (this.getContentElement('youtubePlugin', 'chkResponsive').getValue() === true) {
|
317
|
+
content += '</div>';
|
318
|
+
}
|
319
|
+
}
|
320
|
+
|
321
|
+
var element = CKEDITOR.dom.element.createFromHtml(content);
|
322
|
+
var instance = this.getParentEditor();
|
323
|
+
instance.insertElement(element);
|
324
|
+
}
|
325
|
+
};
|
326
|
+
});
|
327
|
+
}
|
328
|
+
});
|
329
|
+
})();
|
330
|
+
|
331
|
+
function handleLinkChange(el, api) {
|
332
|
+
var video = ytVidId(el.getValue());
|
333
|
+
var time = ytVidTime(el.getValue());
|
334
|
+
|
335
|
+
if (el.getValue().length > 0) {
|
336
|
+
el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').disable();
|
337
|
+
}
|
338
|
+
else if (!disabled.length || !disabled.includes('txtEmbed')) {
|
339
|
+
el.getDialog().getContentElement('youtubePlugin', 'txtEmbed').enable();
|
340
|
+
}
|
341
|
+
|
342
|
+
if (video && time) {
|
343
|
+
var seconds = timeParamToSeconds(time);
|
344
|
+
var hms = secondsToHms(seconds);
|
345
|
+
el.getDialog().getContentElement('youtubePlugin', 'txtStartAt').setValue(hms);
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
function handleEmbedChange(el, api) {
|
350
|
+
if (el.getValue().length > 0) {
|
351
|
+
el.getDialog().getContentElement('youtubePlugin', 'txtUrl').disable();
|
352
|
+
}
|
353
|
+
else {
|
354
|
+
el.getDialog().getContentElement('youtubePlugin', 'txtUrl').enable();
|
355
|
+
}
|
356
|
+
}
|
357
|
+
|
358
|
+
|
359
|
+
/**
|
360
|
+
* JavaScript function to match (and return) the video Id
|
361
|
+
* of any valid Youtube Url, given as input string.
|
362
|
+
* @author: Stephan Schmitz <eyecatchup@gmail.com>
|
363
|
+
* @url: http://stackoverflow.com/a/10315969/624466
|
364
|
+
*/
|
365
|
+
function ytVidId(url) {
|
366
|
+
var p = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/;
|
367
|
+
return (url.match(p)) ? RegExp.$1 : false;
|
368
|
+
}
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Matches and returns time param in YouTube Urls.
|
372
|
+
*/
|
373
|
+
function ytVidTime(url) {
|
374
|
+
var p = /t=([0-9hms]+)/;
|
375
|
+
return (url.match(p)) ? RegExp.$1 : false;
|
376
|
+
}
|
377
|
+
|
378
|
+
/**
|
379
|
+
* Converts time in hms format to seconds only
|
380
|
+
*/
|
381
|
+
function hmsToSeconds(time) {
|
382
|
+
var arr = time.split(':'), s = 0, m = 1;
|
383
|
+
|
384
|
+
while (arr.length > 0) {
|
385
|
+
s += m * parseInt(arr.pop(), 10);
|
386
|
+
m *= 60;
|
387
|
+
}
|
388
|
+
|
389
|
+
return s;
|
390
|
+
}
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Converts seconds to hms format
|
394
|
+
*/
|
395
|
+
function secondsToHms(seconds) {
|
396
|
+
var h = Math.floor(seconds / 3600);
|
397
|
+
var m = Math.floor((seconds / 60) % 60);
|
398
|
+
var s = seconds % 60;
|
399
|
+
|
400
|
+
var pad = function (n) {
|
401
|
+
n = String(n);
|
402
|
+
return n.length >= 2 ? n : "0" + n;
|
403
|
+
};
|
404
|
+
|
405
|
+
if (h > 0) {
|
406
|
+
return pad(h) + ':' + pad(m) + ':' + pad(s);
|
407
|
+
}
|
408
|
+
else {
|
409
|
+
return pad(m) + ':' + pad(s);
|
410
|
+
}
|
411
|
+
}
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Converts time in youtube t-param format to seconds
|
415
|
+
*/
|
416
|
+
function timeParamToSeconds(param) {
|
417
|
+
var componentValue = function (si) {
|
418
|
+
var regex = new RegExp('(\\d+)' + si);
|
419
|
+
return param.match(regex) ? parseInt(RegExp.$1, 10) : 0;
|
420
|
+
};
|
421
|
+
|
422
|
+
return componentValue('h') * 3600
|
423
|
+
+ componentValue('m') * 60
|
424
|
+
+ componentValue('s');
|
425
|
+
}
|
426
|
+
|
427
|
+
/**
|
428
|
+
* Converts seconds into youtube t-param value, e.g. 1h4m30s
|
429
|
+
*/
|
430
|
+
function secondsToTimeParam(seconds) {
|
431
|
+
var h = Math.floor(seconds / 3600);
|
432
|
+
var m = Math.floor((seconds / 60) % 60);
|
433
|
+
var s = seconds % 60;
|
434
|
+
var param = '';
|
435
|
+
|
436
|
+
if (h > 0) {
|
437
|
+
param += h + 'h';
|
438
|
+
}
|
439
|
+
|
440
|
+
if (m > 0) {
|
441
|
+
param += m + 'm';
|
442
|
+
}
|
443
|
+
|
444
|
+
if (s > 0) {
|
445
|
+
param += s + 's';
|
446
|
+
}
|
447
|
+
|
448
|
+
return param;
|
449
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require jquery_ujs
|
3
|
+
//= require jquery3
|
4
|
+
//= require bootstrap-datepicker-1.8.0
|
5
|
+
//= require bootstrap-datepicker-1.8.0.ru.min
|
6
|
+
//= require bootstrap-sprockets
|
7
|
+
//= require font_awesome5
|
8
|
+
//= require ckeditor/init
|
9
|
+
//= require clipboard
|
10
|
+
//= require_tree .
|
11
|
+
|
12
|
+
window.i18n_locale = function(locale) {
|
13
|
+
switch (locale) {
|
14
|
+
case 'en':
|
15
|
+
return({ date_format: 'yyyy-mm-dd', locale: locale });
|
16
|
+
break;
|
17
|
+
case 'ru':
|
18
|
+
return({ date_format: 'dd.mm.yyyy', locale: locale });
|
19
|
+
break;
|
20
|
+
default:
|
21
|
+
return({ date_format: 'yyyy-mm-dd', locale: locale });
|
22
|
+
break;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
$(document).ready(function() {
|
27
|
+
if (!(window.current_locale)) {
|
28
|
+
console.log('You should set `window.current_locale` before all Javascript code');
|
29
|
+
}
|
30
|
+
|
31
|
+
if ($('.date_picker').length != 0) {
|
32
|
+
$('.date_picker').datepicker({
|
33
|
+
format: window.current_locale.date_format,
|
34
|
+
language: window.current_locale.locale
|
35
|
+
});
|
36
|
+
}
|
37
|
+
|
38
|
+
$('.link').click(function() {
|
39
|
+
const href = $(this).data('href');
|
40
|
+
if (href) {
|
41
|
+
location.href = href;
|
42
|
+
} else {
|
43
|
+
const anchor = $(this).data('anchor');
|
44
|
+
if (!$(anchor).offset() == undefined) {
|
45
|
+
$(window).scrollTop($(anchor).offset().top);
|
46
|
+
}
|
47
|
+
};
|
48
|
+
});
|
49
|
+
|
50
|
+
let clipboard = new Clipboard('.clipboard-btn');
|
51
|
+
$(function () {
|
52
|
+
$('[data-toggle="popover"]').popover()
|
53
|
+
})
|
54
|
+
|
55
|
+
const url = new URL(window.location.href);
|
56
|
+
const focusElementSelector = url.searchParams.get('focus');
|
57
|
+
if (!$(focusElementSelector).offset() == undefined) {
|
58
|
+
$(window).scrollTop($(focusElementSelector).offset().top);
|
59
|
+
}
|
60
|
+
});
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/*
|
2
|
+
*= require_tree .
|
3
|
+
*= require_self
|
4
|
+
*/
|
5
|
+
|
6
|
+
@import 'font_awesome5_webfont'
|
7
|
+
@import 'font_awesome5'
|
8
|
+
@import 'bootstrap-datepicker-1.8.0.css'
|
9
|
+
@import 'bootstrap'
|
10
|
+
|
11
|
+
.datepicker-inline
|
12
|
+
display: none !important
|
13
|
+
|
14
|
+
.link
|
15
|
+
cursor: pointer
|
16
|
+
&:hover
|
17
|
+
opacity: 0.8
|
18
|
+
|
19
|
+
.circle
|
20
|
+
border-radius: 50%
|
21
|
+
|
22
|
+
.container
|
23
|
+
padding-top: 2rem
|
24
|
+
|
25
|
+
td
|
26
|
+
&.actions
|
27
|
+
width: 8rem
|
28
|
+
|
29
|
+
.icon-in-navbar
|
30
|
+
font-size: 15pt
|
31
|
+
|
32
|
+
.notifications
|
33
|
+
a
|
34
|
+
margin-right: 25px
|
35
|
+
span.badge:hover
|
36
|
+
filter: brightness(90%)
|
37
|
+
|
38
|
+
.smart_button
|
39
|
+
float: right
|
40
|
+
margin-bottom: 0
|
41
|
+
|
42
|
+
.scrollable
|
43
|
+
height: auto
|
44
|
+
max-height: 30em
|
45
|
+
overflow-x: hidden
|
46
|
+
|
47
|
+
.row-fluid.filters
|
48
|
+
width: 100%
|
49
|
+
display: flex
|
50
|
+
|
51
|
+
select
|
52
|
+
width: 100%
|
53
|
+
|
54
|
+
.submit
|
55
|
+
display: flex
|
56
|
+
flex-direction: row-reverse
|
57
|
+
|
58
|
+
.dates_filter
|
59
|
+
display: flex
|
60
|
+
flex-direction: row
|