drg_cms 0.7.0.2 → 0.7.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/drg_cms/drg_cms.js +63 -18
- data/app/assets/javascripts/drg_cms/jquery.bpopup.js +372 -0
- data/app/assets/javascripts/drg_cms_application.js +1 -1
- data/app/assets/javascripts/drg_cms_cms.js +1 -1
- data/app/assets/stylesheets/drg_cms/drg_cms.css +37 -5
- data/app/assets/stylesheets/drg_cms/select-multiple.css +2 -2
- data/app/controllers/cmsedit_controller.rb +22 -24
- data/app/controllers/dc_application_controller.rb +8 -8
- data/app/controllers/dc_common_controller.rb +9 -6
- data/app/controllers/dc_main_controller.rb +0 -1
- data/app/controls/{dc_category_control.rb → dc_gallery_control.rb} +15 -30
- data/app/controls/dc_image_control.rb +180 -0
- data/app/controls/dc_page_control.rb +3 -3
- data/app/controls/dc_poll_result_control.rb +7 -8
- data/app/controls/dc_report.rb +9 -4
- data/app/controls/design_element_settings_control.rb +88 -37
- data/app/forms/all_options.yml +18 -7
- data/app/forms/cms_menu.yml +7 -2
- data/app/forms/dc_gallery.yml +1 -1
- data/app/forms/dc_image.yml +122 -0
- data/app/forms/dc_image_search.yml +72 -0
- data/app/forms/dc_page.yml +11 -8
- data/app/forms/dc_steps_template.yml +2 -1
- data/app/helpers/cms_common_helper.rb +24 -16
- data/app/helpers/cms_edit_helper.rb +26 -33
- data/app/helpers/cms_helper.rb +21 -5
- data/app/helpers/cms_index_helper.rb +53 -38
- data/app/helpers/dc_application_helper.rb +64 -72
- data/app/helpers/dc_image_helper.rb +127 -0
- data/app/models/concerns/dc_policy_rule_concern.rb +1 -1
- data/app/models/concerns/dc_user_concern.rb +12 -4
- data/app/models/dc_category.rb +12 -0
- data/app/models/dc_design.rb +5 -4
- data/app/models/dc_filter.rb +19 -18
- data/app/models/dc_image.rb +237 -0
- data/app/models/dc_internals.rb +5 -9
- data/app/models/dc_policy_role.rb +8 -8
- data/app/models/drgcms_form_fields/drgcms_field.rb +9 -26
- data/app/models/drgcms_form_fields/embedded.rb +11 -8
- data/app/models/drgcms_form_fields/journal_diff.rb +2 -2
- data/app/models/drgcms_form_fields/multitext_autocomplete.rb +51 -47
- data/app/models/drgcms_form_fields/select.rb +20 -14
- data/app/models/drgcms_form_fields/text_with_select.rb +5 -9
- data/app/renderers/dc_gallery_renderer.rb +10 -4
- data/app/renderers/dc_page_renderer.rb +7 -7
- data/app/renderers/dc_poll_renderer.rb +13 -12
- data/app/views/cmsedit/_edit_stuff.html.erb +1 -1
- data/app/views/cmsedit/edit.html.erb +1 -1
- data/app/views/cmsedit/index.html.erb +1 -1
- data/app/views/cmsedit/new.html.erb +1 -0
- data/config/locales/drgcms_en.yml +14 -2
- data/config/locales/drgcms_sl.yml +13 -2
- data/config/locales/models_en.yml +33 -0
- data/config/locales/models_sl.yml +44 -1
- data/drg_cms.gemspec +1 -1
- data/lib/drg_cms/version.rb +1 -1
- data/lib/drg_cms.rb +19 -5
- data/lib/generators/convert_to_ar/USAGE +8 -0
- data/lib/generators/convert_to_ar/convert_to_ar_generator.rb +158 -0
- metadata +16 -10
- data/app/assets/javascripts/drg_cms/jquery.bpopup.min.js +0 -7
- data/app/views/layouts/__cmsedit.html.erb +0 -16
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2012
|
2
|
+
# Copyright (c) 2012+ Damjan Rems
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -574,6 +574,36 @@ sl:
|
|
574
574
|
active: Aktiven
|
575
575
|
dc_json_lds: Podelement strukture
|
576
576
|
|
577
|
+
dc_image:
|
578
|
+
tabletitle: Organizator slik
|
579
|
+
|
580
|
+
upload_file: Naloži datoteko
|
581
|
+
name: Originalno ime
|
582
|
+
short: Kratek opis
|
583
|
+
text: Daljši opis
|
584
|
+
keep_original: Ohrani original
|
585
|
+
size_o: Prvotna dimenzija
|
586
|
+
size_l: Velika dimenzija
|
587
|
+
size_m: Srednja dimenzija
|
588
|
+
size_s: Mala dimenzija
|
589
|
+
size_ls: Velika dimenzija
|
590
|
+
size_ms: Srednja dimenzija
|
591
|
+
size_ss: Mala dimenzija
|
592
|
+
offset_lx: Zamik X
|
593
|
+
offset_ly: Zamik Y
|
594
|
+
offset_mx: Zamik X
|
595
|
+
offset_my: Zamik Y
|
596
|
+
offset_sx: Zamik X
|
597
|
+
offset_sy: Zamik Y
|
598
|
+
preview_s: Slika
|
599
|
+
preview_m: Slika
|
600
|
+
preview_l: Slika
|
601
|
+
|
602
|
+
categories: Kategorije
|
603
|
+
cats_input: Kategorije
|
604
|
+
categories_line: Kategorije
|
605
|
+
created_by: Naložil
|
606
|
+
|
577
607
|
# help pomoč na obrazcih ####################################################
|
578
608
|
|
579
609
|
help:
|
@@ -985,3 +1015,16 @@ sl:
|
|
985
1015
|
add_schema: Dodaj strukturo
|
986
1016
|
add_error: Element %{schema} že obstaja!
|
987
1017
|
|
1018
|
+
dc_image:
|
1019
|
+
upload_file: Naloži datotekov obdelavo
|
1020
|
+
name: Originalno ime datoteke
|
1021
|
+
short: Kratek opis slike
|
1022
|
+
text: Daljši opis slike
|
1023
|
+
keep_original: Ohrani originalno sliko
|
1024
|
+
size_o: Dimenzije originalne slike
|
1025
|
+
size_l: Dimenzije velike slike
|
1026
|
+
size_m: Dimenzije srednje velike slike
|
1027
|
+
size_s: Dimenzije male slike
|
1028
|
+
categories: Kategorije za poznejše lažje iskanje slike
|
1029
|
+
created_by: Uporabnik, ki je naložil sliko
|
1030
|
+
offset: Offset image before resizing. Offset origin is the top left corner.
|
data/drg_cms.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency 'rails'#, '~> 6.1'
|
24
24
|
s.add_dependency 'jquery-rails'
|
25
25
|
s.add_dependency 'jquery-ui-rails'
|
26
|
-
s.add_dependency 'non-
|
26
|
+
s.add_dependency 'non-digest-assets'
|
27
27
|
|
28
28
|
s.add_dependency 'bcrypt' #, '~> 3.0.0'
|
29
29
|
s.add_dependency 'mongoid'#, '~> 7'
|
data/lib/drg_cms/version.rb
CHANGED
data/lib/drg_cms.rb
CHANGED
@@ -29,7 +29,7 @@ end
|
|
29
29
|
# When new plugin with its own DRG forms is added to application, path to
|
30
30
|
# forms directory must be send to DrgCms module. Paths are saved into @@paths hash variable.
|
31
31
|
#
|
32
|
-
# Adding path is best done in plugin
|
32
|
+
# Adding path is best done in plugin module initialization code.
|
33
33
|
#
|
34
34
|
# Parameters:
|
35
35
|
# [path] String. Path to forms directory
|
@@ -54,7 +54,7 @@ def self.add_forms_path(path)
|
|
54
54
|
end
|
55
55
|
|
56
56
|
###############################################################################
|
57
|
-
# Patching is one of the rubies best
|
57
|
+
# Patching is one of the rubies best strengths and also its curse. Loading
|
58
58
|
# patches in development has become real problem for developers. This is my
|
59
59
|
# way of patch loading.
|
60
60
|
#
|
@@ -85,7 +85,7 @@ end
|
|
85
85
|
# General add path method. Paths are saved into @@paths hash variable. Paths can
|
86
86
|
# then be reused in different parts of application.
|
87
87
|
#
|
88
|
-
# Adding paths is best done in plugin
|
88
|
+
# Adding paths is best done in plugin module initialization code.
|
89
89
|
#
|
90
90
|
# Parameters:
|
91
91
|
# [type] Symbol. Defines type of data. Current used values are :forms, :patches
|
@@ -120,9 +120,9 @@ end
|
|
120
120
|
|
121
121
|
####################################################################
|
122
122
|
# Checks if any errors exist on document and writes error log. It can also
|
123
|
-
# crash if requested. This is mostly
|
123
|
+
# crash if requested. This is mostly useful in development for debugging
|
124
124
|
# model errors or when updating multiple collections and each save must be
|
125
|
-
# checked if
|
125
|
+
# checked if successful.
|
126
126
|
#
|
127
127
|
# @param [Document] Document object which will be checked
|
128
128
|
# @param [Boolean] If true method should end in runtime error. Default = false.
|
@@ -165,6 +165,7 @@ end
|
|
165
165
|
# @param [String] Optional key to be deleted
|
166
166
|
####################################################################
|
167
167
|
def self.cache_clear(key = nil)
|
168
|
+
return unless Rails.cache
|
168
169
|
return Rails.cache.clear if key.nil?
|
169
170
|
|
170
171
|
if redis_cache_store?
|
@@ -211,6 +212,19 @@ def self.cache_write(keys, data)
|
|
211
212
|
data
|
212
213
|
end
|
213
214
|
|
215
|
+
####################################################################
|
216
|
+
# Reads data from mongoid cache. Mongoid has it's own cache, which can be
|
217
|
+
# used to cache results on single request.
|
218
|
+
#
|
219
|
+
# @param [model] class: Model name
|
220
|
+
# @param [id] String || BSON::ObjectId : Id
|
221
|
+
#
|
222
|
+
# @return [Object] data document.
|
223
|
+
####################################################################
|
224
|
+
def self.cached(model, id)
|
225
|
+
Mongoid::QueryCache.cache { model.find(id) }
|
226
|
+
end
|
227
|
+
|
214
228
|
###############################################################################
|
215
229
|
# All Routes required by DrgCms.
|
216
230
|
#
|
@@ -0,0 +1,158 @@
|
|
1
|
+
class ConvertToArGenerator < Rails::Generators::NamedBase
|
2
|
+
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
desc "This generator converts mongoid model to active_record migration"
|
5
|
+
argument :model_name, :type => :string, :default => 'dc_*'
|
6
|
+
argument :migration_name, :type => :string, :default => 'initial_migration'
|
7
|
+
|
8
|
+
TYPES = {
|
9
|
+
String => :string,
|
10
|
+
Time => :datetime,
|
11
|
+
DateTime => :datetime,
|
12
|
+
Object => :integer,
|
13
|
+
Integer => :integer,
|
14
|
+
BSON::ObjectId => :integer,
|
15
|
+
Mongoid::Boolean => :boolean,
|
16
|
+
BigDecimal => [:decimal, :precision => 8, :scale => 2, :default => 0.00],
|
17
|
+
Date => :date,
|
18
|
+
Hash => :text,
|
19
|
+
Array => :text
|
20
|
+
}
|
21
|
+
|
22
|
+
###########################################################################
|
23
|
+
#
|
24
|
+
###########################################################################
|
25
|
+
def create_migration
|
26
|
+
p model_name, migration_name
|
27
|
+
|
28
|
+
code = model_name.match(/\*/) ? migrate_many(model_name) : migrate_one(model_name)
|
29
|
+
code = top(migration_name) + code + bottom
|
30
|
+
create_file "db/#{source_file_name(migration_name).underscore}.rb", code
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
###########################################################################
|
36
|
+
#
|
37
|
+
###########################################################################
|
38
|
+
def source_file_name(migration)
|
39
|
+
"#{Time.now.strftime("%Y%m%d%H%M%S")}_#{migration}"
|
40
|
+
end
|
41
|
+
|
42
|
+
###########################################################################
|
43
|
+
#
|
44
|
+
###########################################################################
|
45
|
+
def migrate_one(model_name)
|
46
|
+
mongo_model = model_name.classify.constantize
|
47
|
+
new_model_name = model_name.start_with?('dc_') ? model_name.sub('dc_', 'ar_') : model_name
|
48
|
+
code = %( create_table :#{new_model_name.pluralize} do |t|\n)
|
49
|
+
left = ' t.'
|
50
|
+
timestamps = false
|
51
|
+
# fields
|
52
|
+
document = mongo_model.new
|
53
|
+
document.attribute_names.each do |attribute_name|
|
54
|
+
next if attribute_name == '_id'
|
55
|
+
if %w[created_at updated_at].include?(attribute_name)
|
56
|
+
timestamps = true
|
57
|
+
next
|
58
|
+
end
|
59
|
+
|
60
|
+
options = mongo_model.fields[attribute_name].options
|
61
|
+
pp "Undefined type #{options[:type]} for #{mongo_model}.#{attribute_name}" unless TYPES[options[:type]]
|
62
|
+
att_name = attribute_name.sub(/^dc_/,'ar_')
|
63
|
+
code << %(#{left}#{TYPES[options[:type]]} :#{att_name})
|
64
|
+
code << %(, default: #{get_default(options[:default], options[:type])}) if options[:default]
|
65
|
+
code << "\n"
|
66
|
+
end
|
67
|
+
code << %(\n#{left}timestamps\n) if timestamps
|
68
|
+
|
69
|
+
# indexes
|
70
|
+
if document.index_specifications.any?
|
71
|
+
code << "\n"
|
72
|
+
document.index_specifications.each do |index|
|
73
|
+
code << "#{left}index "
|
74
|
+
code << (index.fields.size > 1 ? "[:#{index.fields.join(', :')}]" : ":#{index.fields.first}")
|
75
|
+
code << ", #{index.options.to_s.gsub(/\{|\}/, '')}" if index.options.size > 0
|
76
|
+
code << "\n"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# export some test data
|
81
|
+
data = []
|
82
|
+
mongo_model.all.limit(5).each do |doc|
|
83
|
+
#data << doc.as_document.inject([]) { |r, e| [e.first.sub(/^dc_/,'ar_'), e.last] }
|
84
|
+
data << doc.as_document.map { |e| [e.first.sub(/^dc_/,'ar_'), e.last] }
|
85
|
+
end
|
86
|
+
File.write("db/#{new_model_name}.json", data.to_json)
|
87
|
+
|
88
|
+
code << " end\n\n"
|
89
|
+
end
|
90
|
+
|
91
|
+
###########################################################################
|
92
|
+
#
|
93
|
+
###########################################################################
|
94
|
+
def get_default(default, type)
|
95
|
+
case type.to_s
|
96
|
+
when 'String' then "'#{default}'"
|
97
|
+
else default
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
#########################################################################
|
102
|
+
# Return array of all models found in application.
|
103
|
+
#########################################################################
|
104
|
+
def all_collections
|
105
|
+
collections = []
|
106
|
+
DrgCms.paths(:forms).each do |path|
|
107
|
+
models_dir = File.expand_path("../models", path)
|
108
|
+
Dir["#{models_dir}/*.rb"].each do |model_file|
|
109
|
+
model_file =~ /(.*)\/(.*).rb/
|
110
|
+
# check if model exists
|
111
|
+
collection = $2.camelize.constantize.new rescue nil
|
112
|
+
collections << collection.class.to_s.underscore if collection&.respond_to?(:_id)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
collections.sort
|
116
|
+
end
|
117
|
+
|
118
|
+
###########################################################################
|
119
|
+
#
|
120
|
+
###########################################################################
|
121
|
+
def migrate_many(model_name)
|
122
|
+
selector = model_name[0, model_name.index('*') - 1].downcase
|
123
|
+
p selector
|
124
|
+
|
125
|
+
list = all_collections.select { |name| name.starts_with?(selector) }
|
126
|
+
list.inject('') { |r, e| r << migrate_one(e) }
|
127
|
+
end
|
128
|
+
|
129
|
+
###########################################################################
|
130
|
+
#class #{migration_name} < ActiveRecord::Migration[7.0]
|
131
|
+
# def change
|
132
|
+
# create_table :products do |t|
|
133
|
+
# t.string :name
|
134
|
+
# t.text :description
|
135
|
+
#
|
136
|
+
# t.timestamps = true
|
137
|
+
# end
|
138
|
+
# end
|
139
|
+
# end
|
140
|
+
###########################################################################
|
141
|
+
def top(migration_name)
|
142
|
+
<<EOT
|
143
|
+
class #{migration_name.classify} < ActiveRecord::Migration[7.0]
|
144
|
+
def change
|
145
|
+
EOT
|
146
|
+
end
|
147
|
+
|
148
|
+
###########################################################################
|
149
|
+
#
|
150
|
+
###########################################################################
|
151
|
+
def bottom
|
152
|
+
<<EOT
|
153
|
+
end
|
154
|
+
end
|
155
|
+
EOT
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: non-
|
56
|
+
name: non-digest-assets
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -196,7 +196,7 @@ files:
|
|
196
196
|
- app/assets/images/throbber.gif
|
197
197
|
- app/assets/javascripts/drg_cms/drg_cms.js
|
198
198
|
- app/assets/javascripts/drg_cms/jquery-migrate.js
|
199
|
-
- app/assets/javascripts/drg_cms/jquery.bpopup.
|
199
|
+
- app/assets/javascripts/drg_cms/jquery.bpopup.js
|
200
200
|
- app/assets/javascripts/drg_cms/jquery.datetimepicker.js
|
201
201
|
- app/assets/javascripts/drg_cms/jstree.min.js
|
202
202
|
- app/assets/javascripts/drg_cms/select-multiple.js
|
@@ -217,8 +217,9 @@ files:
|
|
217
217
|
- app/controllers/dc_main_controller.rb
|
218
218
|
- app/controls/browse_models_control.rb
|
219
219
|
- app/controls/cmsedit_control.rb
|
220
|
-
- app/controls/
|
220
|
+
- app/controls/dc_gallery_control.rb
|
221
221
|
- app/controls/dc_help_control.rb
|
222
|
+
- app/controls/dc_image_control.rb
|
222
223
|
- app/controls/dc_page_control.rb
|
223
224
|
- app/controls/dc_poll_result_control.rb
|
224
225
|
- app/controls/dc_report.rb
|
@@ -240,6 +241,8 @@ files:
|
|
240
241
|
- app/forms/dc_gallery.yml
|
241
242
|
- app/forms/dc_help_1.yml
|
242
243
|
- app/forms/dc_ident.yml
|
244
|
+
- app/forms/dc_image.yml
|
245
|
+
- app/forms/dc_image_search.yml
|
243
246
|
- app/forms/dc_journal.yml
|
244
247
|
- app/forms/dc_json_ld.yml
|
245
248
|
- app/forms/dc_key_value.yml
|
@@ -277,6 +280,7 @@ files:
|
|
277
280
|
- app/helpers/cms_index_helper.rb
|
278
281
|
- app/helpers/dc_application_helper.rb
|
279
282
|
- app/helpers/dc_category_helper.rb
|
283
|
+
- app/helpers/dc_image_helper.rb
|
280
284
|
- app/models/concerns/dc_page_concern.rb
|
281
285
|
- app/models/concerns/dc_piece_concern.rb
|
282
286
|
- app/models/concerns/dc_policy_rule_concern.rb
|
@@ -295,6 +299,7 @@ files:
|
|
295
299
|
- app/models/dc_folder_permission.rb
|
296
300
|
- app/models/dc_gallery.rb
|
297
301
|
- app/models/dc_ident.rb
|
302
|
+
- app/models/dc_image.rb
|
298
303
|
- app/models/dc_internals.rb
|
299
304
|
- app/models/dc_journal.rb
|
300
305
|
- app/models/dc_json_ld.rb
|
@@ -376,7 +381,6 @@ files:
|
|
376
381
|
- app/views/dc_common/_help.html.erb
|
377
382
|
- app/views/dc_common/_iframe_edit.html.erb
|
378
383
|
- app/views/dc_common/paste_clipboard.html.erb
|
379
|
-
- app/views/layouts/__cmsedit.html.erb
|
380
384
|
- app/views/layouts/cms.html.erb
|
381
385
|
- app/views/layouts/content.html.erb
|
382
386
|
- app/views/layouts/models.html.erb
|
@@ -396,6 +400,8 @@ files:
|
|
396
400
|
- lib/drg_cms.rb
|
397
401
|
- lib/drg_cms/engine.rb
|
398
402
|
- lib/drg_cms/version.rb
|
403
|
+
- lib/generators/convert_to_ar/USAGE
|
404
|
+
- lib/generators/convert_to_ar/convert_to_ar_generator.rb
|
399
405
|
- lib/generators/new_drg_form/USAGE
|
400
406
|
- lib/generators/new_drg_form/new_drg_form_generator.rb
|
401
407
|
- lib/tasks/browse_models.rake
|
@@ -440,7 +446,7 @@ homepage: https://www.drgcms.org
|
|
440
446
|
licenses:
|
441
447
|
- MIT
|
442
448
|
metadata: {}
|
443
|
-
post_install_message:
|
449
|
+
post_install_message:
|
444
450
|
rdoc_options: []
|
445
451
|
require_paths:
|
446
452
|
- lib
|
@@ -455,8 +461,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
455
461
|
- !ruby/object:Gem::Version
|
456
462
|
version: '0'
|
457
463
|
requirements: []
|
458
|
-
rubygems_version: 3.
|
459
|
-
signing_key:
|
464
|
+
rubygems_version: 3.4.10
|
465
|
+
signing_key:
|
460
466
|
specification_version: 4
|
461
467
|
summary: 'DRG: Rapid web application development tool and CMS for Ruby, Rails and
|
462
468
|
MongoDB'
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/*================================================================================
|
2
|
-
* @name: bPopup - if you can't get it up, use bPopup
|
3
|
-
* @author: (c)Bjoern Klinggaard (twitter@bklinggaard)
|
4
|
-
* @demo: http://dinbror.dk/bpopup
|
5
|
-
* @version: 0.11.0.min
|
6
|
-
================================================================================*/
|
7
|
-
(function(c){c.fn.bPopup=function(A,E){function L(){a.contentContainer=c(a.contentContainer||b);switch(a.content){case "iframe":var d=c('<iframe class="b-iframe" '+a.iframeAttr+"></iframe>");d.appendTo(a.contentContainer);t=b.outerHeight(!0);u=b.outerWidth(!0);B();d.attr("src",a.loadUrl);l(a.loadCallback);break;case "image":B();c("<img />").load(function(){l(a.loadCallback);F(c(this))}).attr("src",a.loadUrl).hide().appendTo(a.contentContainer);break;default:B(),c('<div class="b-ajax-wrapper"></div>').load(a.loadUrl,a.loadData,function(d,b,e){l(a.loadCallback,b);F(c(this))}).hide().appendTo(a.contentContainer)}}function B(){a.modal&&c('<div class="b-modal '+e+'"></div>').css({backgroundColor:a.modalColor,position:"fixed",top:0,right:0,bottom:0,left:0,opacity:0,zIndex:a.zIndex+v}).appendTo(a.appendTo).fadeTo(a.speed,a.opacity);C();b.data("bPopup",a).data("id",e).css({left:"slideIn"==a.transition||"slideBack"==a.transition?"slideBack"==a.transition?f.scrollLeft()+w:-1*(x+u):m(!(!a.follow[0]&&n||g)),position:a.positionStyle||"absolute",top:"slideDown"==a.transition||"slideUp"==a.transition?"slideUp"==a.transition?f.scrollTop()+y:z+-1*t:p(!(!a.follow[1]&&q||g)),"z-index":a.zIndex+v+1}).each(function(){a.appending&&c(this).appendTo(a.appendTo)});G(!0)}function r(){a.modal&&c(".b-modal."+b.data("id")).fadeTo(a.speed,0,function(){c(this).remove()});a.scrollBar||c("html").css("overflow","auto");c(".b-modal."+e).unbind("click");f.unbind("keydown."+e);k.unbind("."+e).data("bPopup",0<k.data("bPopup")-1?k.data("bPopup")-1:null);b.undelegate(".bClose, ."+a.closeClass,"click."+e,r).data("bPopup",null);clearTimeout(H);G();return!1}function I(d){y=k.height();w=k.width();h=D();if(h.x||h.y)clearTimeout(J),J=setTimeout(function(){C();d=d||a.followSpeed;var e={};h.x&&(e.left=a.follow[0]?m(!0):"auto");h.y&&(e.top=a.follow[1]?p(!0):"auto");b.dequeue().each(function(){g?c(this).css({left:x,top:z}):c(this).animate(e,d,a.followEasing)})},50)}function F(d){var c=d.width(),e=d.height(),f={};a.contentContainer.css({height:e,width:c});e>=b.height()&&(f.height=b.height());c>=b.width()&&(f.width=b.width());t=b.outerHeight(!0);u=b.outerWidth(!0);C();a.contentContainer.css({height:"auto",width:"auto"});f.left=m(!(!a.follow[0]&&n||g));f.top=p(!(!a.follow[1]&&q||g));b.animate(f,250,function(){d.show();h=D()})}function M(){k.data("bPopup",v);b.delegate(".bClose, ."+a.closeClass,"click."+e,r);a.modalClose&&c(".b-modal."+e).css("cursor","pointer").bind("click",r);N||!a.follow[0]&&!a.follow[1]||k.bind("scroll."+e,function(){if(h.x||h.y){var d={};h.x&&(d.left=a.follow[0]?m(!g):"auto");h.y&&(d.top=a.follow[1]?p(!g):"auto");b.dequeue().animate(d,a.followSpeed,a.followEasing)}}).bind("resize."+e,function(){I()});a.escClose&&f.bind("keydown."+e,function(a){27==a.which&&r()})}function G(d){function c(e){b.css({display:"block",opacity:1}).animate(e,a.speed,a.easing,function(){K(d)})}switch(d?a.transition:a.transitionClose||a.transition){case "slideIn":c({left:d?m(!(!a.follow[0]&&n||g)):f.scrollLeft()-(u||b.outerWidth(!0))-200});break;case "slideBack":c({left:d?m(!(!a.follow[0]&&n||g)):f.scrollLeft()+w+200});break;case "slideDown":c({top:d?p(!(!a.follow[1]&&q||g)):f.scrollTop()-(t||b.outerHeight(!0))-200});break;case "slideUp":c({top:d?p(!(!a.follow[1]&&q||g)):f.scrollTop()+y+200});break;default:b.stop().fadeTo(a.speed,d?1:0,function(){K(d)})}}function K(d){d?(M(),l(E),a.autoClose&&(H=setTimeout(r,a.autoClose))):(b.hide(),l(a.onClose),a.loadUrl&&(a.contentContainer.empty(),b.css({height:"auto",width:"auto"})))}function m(a){return a?x+f.scrollLeft():x}function p(a){return a?z+f.scrollTop():z}function l(a,e){c.isFunction(a)&&a.call(b,e)}function C(){z=q?a.position[1]:Math.max(0,(y-b.outerHeight(!0))/2-a.amsl);x=n?a.position[0]:(w-b.outerWidth(!0))/2;h=D()}function D(){return{x:w>b.outerWidth(!0),y:y>b.outerHeight(!0)}}c.isFunction(A)&&(E=A,A=null);var a=c.extend({},c.fn.bPopup.defaults,A);a.scrollBar||c("html").css("overflow","hidden");var b=this,f=c(document),k=c(window),y=k.height(),w=k.width(),N=/OS 6(_\d)+/i.test(navigator.userAgent),v=0,e,h,q,n,g,z,x,t,u,J,H;b.close=function(){r()};b.reposition=function(a){I(a)};return b.each(function(){c(this).data("bPopup")||(l(a.onOpen),v=(k.data("bPopup")||0)+1,e="__b-popup"+v+"__",q="auto"!==a.position[1],n="auto"!==a.position[0],g="fixed"===a.positionStyle,t=b.outerHeight(!0),u=b.outerWidth(!0),a.loadUrl?L():B())})};c.fn.bPopup.defaults={amsl:50,appending:!0,appendTo:"body",autoClose:!1,closeClass:"b-close",content:"ajax",contentContainer:!1,easing:"swing",escClose:!0,follow:[!0,!0],followEasing:"swing",followSpeed:500,iframeAttr:'scrolling="no" frameborder="0"',loadCallback:!1,loadData:!1,loadUrl:!1,modal:!0,modalClose:!0,modalColor:"#000",onClose:!1,onOpen:!1,opacity:.7,position:["auto","auto"],positionStyle:"absolute",scrollBar:!0,speed:250,transition:"fadeIn",transitionClose:!1,zIndex:9997}})(jQuery);
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title><%= @page_title %></title>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
-
<%= stylesheet_link_tag "cms", media: 'all' %>
|
7
|
-
<style type="text/css" media="all"><%= "#{@site.css}#{@design.css}\n#{@page.css}".html_safe if @page %></style>
|
8
|
-
<%= @site.header.html_safe if @site %>
|
9
|
-
<%= javascript_include_tag "cms" %>
|
10
|
-
<%= csrf_meta_tags %>
|
11
|
-
</head>
|
12
|
-
|
13
|
-
<body>
|
14
|
-
<%= yield %>
|
15
|
-
</body>
|
16
|
-
</html>
|