sunrise-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +46 -0
- data/Rakefile +44 -0
- data/app/controllers/manage/assets_controller.rb +70 -0
- data/app/controllers/manage/base_controller.rb +24 -0
- data/app/controllers/manage/pages_controller.rb +37 -0
- data/app/controllers/manage/settings_controller.rb +24 -0
- data/app/controllers/manage/structures_controller.rb +45 -0
- data/app/controllers/manage/users_controller.rb +78 -0
- data/app/controllers/pages_controller.rb +22 -0
- data/app/views/layouts/manage.html.erb +40 -0
- data/app/views/manage/assets/_collection.html.erb +32 -0
- data/app/views/manage/assets/_picture.html.erb +10 -0
- data/app/views/manage/assets/_swfscript.html.erb +51 -0
- data/app/views/manage/headers/_form.html.erb +14 -0
- data/app/views/manage/pages/_form.html.erb +11 -0
- data/app/views/manage/pages/edit.html.erb +6 -0
- data/app/views/manage/pages/new.html.erb +6 -0
- data/app/views/manage/settings/_form.html.erb +22 -0
- data/app/views/manage/settings/index.html.erb +14 -0
- data/app/views/manage/shared/_head.html.erb +41 -0
- data/app/views/manage/shared/_locale.html.erb +8 -0
- data/app/views/manage/shared/_notice.html.erb +7 -0
- data/app/views/manage/shared/_panel.html.erb +34 -0
- data/app/views/manage/structures/_form.html.erb +28 -0
- data/app/views/manage/structures/_structure.html.erb +34 -0
- data/app/views/manage/structures/edit.html.erb +6 -0
- data/app/views/manage/structures/index.html.erb +51 -0
- data/app/views/manage/structures/new.html.erb +6 -0
- data/app/views/manage/users/_form.html.erb +15 -0
- data/app/views/manage/users/_model_filter.html.erb +33 -0
- data/app/views/manage/users/_user.html.erb +55 -0
- data/app/views/manage/users/edit.html.erb +6 -0
- data/app/views/manage/users/index.html.erb +36 -0
- data/app/views/manage/users/new.html.erb +6 -0
- data/app/views/manage/users/show.html.erb +19 -0
- data/config/locales/defaults/en.yml +149 -0
- data/config/locales/defaults/pluralize.rb +6 -0
- data/config/locales/defaults/ru.yml +170 -0
- data/config/locales/defaults/uk.yml +238 -0
- data/config/locales/devise.en.yml +39 -0
- data/config/locales/devise.ru.yml +41 -0
- data/config/locales/devise.uk.yml +41 -0
- data/config/locales/manage/en.yml +248 -0
- data/config/locales/manage/ru.yml +248 -0
- data/config/locales/manage/uk.yml +248 -0
- data/config/routes.rb +24 -0
- data/lib/generators/sunrise/USAGE +7 -0
- data/lib/generators/sunrise/install_generator.rb +120 -0
- data/lib/generators/sunrise/templates/config/application.yml +4 -0
- data/lib/generators/sunrise/templates/config/database.yml +34 -0
- data/lib/generators/sunrise/templates/config/logrotate-config +9 -0
- data/lib/generators/sunrise/templates/config/nginx-config-passenger +51 -0
- data/lib/generators/sunrise/templates/config/seeds.rb +25 -0
- data/lib/generators/sunrise/templates/config/sunrise.rb +7 -0
- data/lib/generators/sunrise/templates/helpers/manage/assets_helper.rb +16 -0
- data/lib/generators/sunrise/templates/helpers/manage/base_helper.rb +81 -0
- data/lib/generators/sunrise/templates/helpers/manage/pages_helper.rb +2 -0
- data/lib/generators/sunrise/templates/helpers/manage/settings_helper.rb +2 -0
- data/lib/generators/sunrise/templates/helpers/manage/structures_helper.rb +12 -0
- data/lib/generators/sunrise/templates/helpers/manage/users_helper.rb +6 -0
- data/lib/generators/sunrise/templates/images/manage/add_post_bot.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/add_post_top.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/add_white_bot.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/add_white_top.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/arrow.png +0 -0
- data/lib/generators/sunrise/templates/images/manage/back_but_lc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/back_but_rc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/bot_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/bot_duo_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_bg.png +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_block_lc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_block_rc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_freze_lc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_freze_rc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_gr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_gr_l.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_gr_r.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_search.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_unfreze_lc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/but_unfreze_rc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/button_add_foto.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/button_add_foto_ru.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/button_add_foto_ua.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/button_add_foto_uk.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/cancelbutton.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/dark_arr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/dark_arr_left.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/dark_cross_ico.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/dot.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bg_small.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bg_small_blocked.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bg_small_frozed.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bg_small_notact.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bot_small.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bot_small_blocked.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bot_small_frozed.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_bot_small_notact.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_top_small.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_top_small_blocked.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_top_small_frozed.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/duo_top_small_notact.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/edit_white_top.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/empty.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/filter_bot_bg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/filter_top_bg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/flag_en.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/flag_en_nonact.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/flag_ru.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/flag_ru_nonact.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/flag_ua.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/flag_ua_nonact.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/foto.jpg +0 -0
- data/lib/generators/sunrise/templates/images/manage/ico_add.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/ico_del.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/ico_down.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/ico_edit.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/ico_settings.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/ico_up.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/input_bg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/l_but_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/minimise_but.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/mp3.png +0 -0
- data/lib/generators/sunrise/templates/images/manage/page_arr_hover.png +0 -0
- data/lib/generators/sunrise/templates/images/manage/page_next_arr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/page_num_hover.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/page_prev_arr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/panel/l_but_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/panel/maximise_but.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/panel/r_but_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/panel/top_menu_arr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/panel/user_pic.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/preloader.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/r_but_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/select_bg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/select_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/struct_corn_lg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/struct_corn_llg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/struct_corn_lw.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/struct_corn_rg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/struct_corn_rlg.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/struct_corn_rw.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/tab_gl.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/tab_gr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/tab_wl.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/tab_wr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/top_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/top_duo_corn.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/top_menu_arr.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/transp_cross.png +0 -0
- data/lib/generators/sunrise/templates/images/manage/upload_progress.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/user_act_lc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/user_act_rc.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/user_ico.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/user_pic.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/user_pic_small.gif +0 -0
- data/lib/generators/sunrise/templates/images/manage/user_pic_thumb.gif +0 -0
- data/lib/generators/sunrise/templates/javascripts/datepicker/jquery-ui-i18n.js +1176 -0
- data/lib/generators/sunrise/templates/javascripts/datepicker/jquery.ui.datepicker-ru.js +37 -0
- data/lib/generators/sunrise/templates/javascripts/datepicker/jquery.ui.datepicker-uk.js +37 -0
- data/lib/generators/sunrise/templates/javascripts/jquery-ui-timepicker-addon.js +911 -0
- data/lib/generators/sunrise/templates/javascripts/jquery.cookie.js +97 -0
- data/lib/generators/sunrise/templates/javascripts/jquery.fancybox-1.3.4.pack.js +46 -0
- data/lib/generators/sunrise/templates/javascripts/jquery.tmpl.min.js +10 -0
- data/lib/generators/sunrise/templates/javascripts/manage.js +290 -0
- data/lib/generators/sunrise/templates/javascripts/preloader.js +47 -0
- data/lib/generators/sunrise/templates/javascripts/swfupload/fileprogress.js +114 -0
- data/lib/generators/sunrise/templates/javascripts/swfupload/handlers.js +164 -0
- data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.js +1134 -0
- data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.queue.js +98 -0
- data/lib/generators/sunrise/templates/javascripts/swfupload/swfupload.swf +0 -0
- data/lib/generators/sunrise/templates/migrate/create_assets.rb +28 -0
- data/lib/generators/sunrise/templates/migrate/create_headers.rb +20 -0
- data/lib/generators/sunrise/templates/migrate/create_pages.rb +17 -0
- data/lib/generators/sunrise/templates/migrate/create_roles.rb +16 -0
- data/lib/generators/sunrise/templates/migrate/create_structures.rb +27 -0
- data/lib/generators/sunrise/templates/migrate/create_users.rb +29 -0
- data/lib/generators/sunrise/templates/models/defaults/ability.rb +38 -0
- data/lib/generators/sunrise/templates/models/defaults/asset.rb +7 -0
- data/lib/generators/sunrise/templates/models/defaults/attachment_file.rb +33 -0
- data/lib/generators/sunrise/templates/models/defaults/avatar.rb +36 -0
- data/lib/generators/sunrise/templates/models/defaults/header.rb +5 -0
- data/lib/generators/sunrise/templates/models/defaults/page.rb +5 -0
- data/lib/generators/sunrise/templates/models/defaults/picture.rb +34 -0
- data/lib/generators/sunrise/templates/models/defaults/position_type.rb +7 -0
- data/lib/generators/sunrise/templates/models/defaults/role.rb +20 -0
- data/lib/generators/sunrise/templates/models/defaults/role_type.rb +8 -0
- data/lib/generators/sunrise/templates/models/defaults/structure.rb +11 -0
- data/lib/generators/sunrise/templates/models/defaults/structure_type.rb +9 -0
- data/lib/generators/sunrise/templates/models/defaults/user.rb +51 -0
- data/lib/generators/sunrise/templates/stylesheets/application.css +1 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/blank.gif +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_close.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_loading.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_nav_left.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_nav_right.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_e.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_n.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_ne.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_nw.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_s.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_se.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_sw.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_shadow_w.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_title_left.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_title_main.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_title_over.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancy_title_right.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancybox-x.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancybox-y.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/images/fancybox.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/fancybox/jquery.fancybox-1.3.4.css +359 -0
- data/lib/generators/sunrise/templates/stylesheets/manage/ie.css +16 -0
- data/lib/generators/sunrise/templates/stylesheets/manage/main.css +1074 -0
- data/lib/generators/sunrise/templates/stylesheets/manage/panel.css +126 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/lib/generators/sunrise/templates/stylesheets/smoothness/jquery-ui-1.8.6.custom.css +572 -0
- data/lib/generators/sunrise/templates/sweepers/page_sweeper.rb +22 -0
- data/lib/generators/sunrise/templates/sweepers/structure_sweeper.rb +29 -0
- data/lib/generators/sunrise/templates/sweepers/user_sweeper.rb +17 -0
- data/lib/generators/sunrise/templates/views/layouts/application.html.erb +37 -0
- data/lib/generators/sunrise/templates/views/pages/show.html.erb +2 -0
- data/lib/generators/sunrise/templates/views/shared/_notice.html.erb +17 -0
- data/lib/sunrise/controllers/head_options.rb +40 -0
- data/lib/sunrise/core.rb +80 -0
- data/lib/sunrise/core_ext/array.rb +22 -0
- data/lib/sunrise/core_ext/i18n.rb +21 -0
- data/lib/sunrise/core_ext/string.rb +28 -0
- data/lib/sunrise/core_ext.rb +3 -0
- data/lib/sunrise/core_plugins.rb +32 -0
- data/lib/sunrise/engine.rb +45 -0
- data/lib/sunrise/model_filter.rb +158 -0
- data/lib/sunrise/models/asset.rb +102 -0
- data/lib/sunrise/models/header.rb +34 -0
- data/lib/sunrise/models/page.rb +27 -0
- data/lib/sunrise/models/position_type.rb +15 -0
- data/lib/sunrise/models/role.rb +28 -0
- data/lib/sunrise/models/role_type.rb +15 -0
- data/lib/sunrise/models/structure.rb +43 -0
- data/lib/sunrise/models/structure_type.rb +15 -0
- data/lib/sunrise/models/user.rb +124 -0
- data/lib/sunrise/plugin.rb +46 -0
- data/lib/sunrise/plugins.rb +56 -0
- data/lib/sunrise/system_settings.rb +65 -0
- data/lib/sunrise/utils/accessible_attributes.rb +32 -0
- data/lib/sunrise/utils/header.rb +29 -0
- data/lib/sunrise/utils/i18n_backend.rb +87 -0
- data/lib/sunrise/utils/mysql.rb +105 -0
- data/lib/sunrise/utils/settingslogic.rb +164 -0
- data/lib/sunrise/utils/transliteration.rb +72 -0
- data/lib/sunrise/version.rb +3 -0
- data/lib/sunrise/views/form_builder.rb +44 -0
- data/lib/sunrise/views/helpers.rb +190 -0
- data/lib/sunrise/views/inputs/date_time_input.rb +46 -0
- data/lib/sunrise-core.rb +2 -0
- metadata +492 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
require "yaml"
|
|
3
|
+
require "erb"
|
|
4
|
+
|
|
5
|
+
module Sunrise
|
|
6
|
+
module Utils
|
|
7
|
+
# A simple settings solution using a YAML file. See README for more information.
|
|
8
|
+
class Settingslogic < Hash
|
|
9
|
+
class MissingSetting < StandardError; end
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def name # :nodoc:
|
|
13
|
+
instance.key?("name") ? instance.name : super
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Enables Settings.get('nested.key.name') for dynamic access
|
|
17
|
+
def get(key)
|
|
18
|
+
parts = key.split('.')
|
|
19
|
+
curs = self
|
|
20
|
+
while p = parts.shift
|
|
21
|
+
curs = curs.send(p)
|
|
22
|
+
end
|
|
23
|
+
curs
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def source(value = nil)
|
|
27
|
+
if value.nil?
|
|
28
|
+
@source
|
|
29
|
+
else
|
|
30
|
+
@source = value
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def namespace(value = nil)
|
|
35
|
+
if value.nil?
|
|
36
|
+
@namespace
|
|
37
|
+
else
|
|
38
|
+
@namespace = value
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def [](key)
|
|
43
|
+
instance.fetch(key.to_s, nil)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def []=(key, val)
|
|
47
|
+
# Setting[:key][:key2] = 'value' for dynamic settings
|
|
48
|
+
val = new(val, source) if val.is_a? Hash
|
|
49
|
+
instance.store(key.to_s, val)
|
|
50
|
+
instance.create_accessor_for(key, val)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def load!
|
|
54
|
+
instance
|
|
55
|
+
true
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def reload!
|
|
59
|
+
@instance = nil
|
|
60
|
+
load!
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
def instance
|
|
65
|
+
return @instance if @instance
|
|
66
|
+
@instance = new
|
|
67
|
+
create_accessors!
|
|
68
|
+
@instance
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def method_missing(name, *args, &block)
|
|
72
|
+
instance.send(name, *args, &block)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# It would be great to DRY this up somehow, someday, but it's difficult because
|
|
76
|
+
# of the singleton pattern. Basically this proxies Setting.foo to Setting.instance.foo
|
|
77
|
+
def create_accessors!
|
|
78
|
+
instance.each do |key,val|
|
|
79
|
+
create_accessor_for(key)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def create_accessor_for(key)
|
|
84
|
+
return unless key.to_s =~ /^\w+$/ # could have "some-setting:" which blows up eval
|
|
85
|
+
instance_eval "def #{key}; instance.send(:#{key}); end"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Initializes a new settings object. You can initialize an object in any of the following ways:
|
|
91
|
+
#
|
|
92
|
+
# Settings.new(:application) # will look for config/application.yml
|
|
93
|
+
# Settings.new("application.yaml") # will look for application.yaml
|
|
94
|
+
# Settings.new("/var/configs/application.yml") # will look for /var/configs/application.yml
|
|
95
|
+
# Settings.new(:config1 => 1, :config2 => 2)
|
|
96
|
+
#
|
|
97
|
+
# Basically if you pass a symbol it will look for that file in the configs directory of your rails app,
|
|
98
|
+
# if you are using this in rails. If you pass a string it should be an absolute path to your settings file.
|
|
99
|
+
# Then you can pass a hash, and it just allows you to access the hash via methods.
|
|
100
|
+
def initialize(hash_or_file = self.class.source, section = nil)
|
|
101
|
+
#puts "new! #{hash_or_file}"
|
|
102
|
+
case hash_or_file
|
|
103
|
+
when nil
|
|
104
|
+
raise Errno::ENOENT, "No file specified as Settingslogic source"
|
|
105
|
+
when Hash
|
|
106
|
+
self.replace hash_or_file
|
|
107
|
+
else
|
|
108
|
+
hash = YAML.load(ERB.new(File.read(hash_or_file)).result).to_hash
|
|
109
|
+
hash = hash[self.class.namespace] if self.class.namespace
|
|
110
|
+
self.replace hash
|
|
111
|
+
end
|
|
112
|
+
@section = section || self.class.source # so end of error says "in application.yml"
|
|
113
|
+
create_accessors!
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Called for dynamically-defined keys, and also the first key deferenced at the top-level, if load! is not used.
|
|
117
|
+
# Otherwise, create_accessors! (called by new) will have created actual methods for each key.
|
|
118
|
+
def method_missing(name, *args, &block)
|
|
119
|
+
key = name.to_s
|
|
120
|
+
raise MissingSetting, "Missing setting '#{key}' in #{@section}" unless has_key? key
|
|
121
|
+
value = fetch(key)
|
|
122
|
+
create_accessor_for(key)
|
|
123
|
+
value.is_a?(Hash) ? self.class.new(value, "'#{key}' section in #{@section}") : value
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def [](key)
|
|
127
|
+
fetch(key.to_s, nil)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def []=(key,val)
|
|
131
|
+
# Setting[:key][:key2] = 'value' for dynamic settings
|
|
132
|
+
val = self.class.new(val, @section) if val.is_a? Hash
|
|
133
|
+
store(key.to_s, val)
|
|
134
|
+
create_accessor_for(key, val)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# This handles naming collisions with Sinatra/Vlad/Capistrano. Since these use a set()
|
|
138
|
+
# helper that defines methods in Object, ANY method_missing ANYWHERE picks up the Vlad/Sinatra
|
|
139
|
+
# settings! So settings.deploy_to title actually calls Object.deploy_to (from set :deploy_to, "host"),
|
|
140
|
+
# rather than the app_yml['deploy_to'] hash. Jeezus.
|
|
141
|
+
def create_accessors!
|
|
142
|
+
self.each do |key,val|
|
|
143
|
+
create_accessor_for(key)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Use instance_eval/class_eval because they're actually more efficient than define_method{}
|
|
148
|
+
# http://stackoverflow.com/questions/185947/ruby-definemethod-vs-def
|
|
149
|
+
# http://bmorearty.wordpress.com/2009/01/09/fun-with-rubys-instance_eval-and-class_eval/
|
|
150
|
+
def create_accessor_for(key, val=nil)
|
|
151
|
+
return unless key.to_s =~ /^\w+$/ # could have "some-setting:" which blows up eval
|
|
152
|
+
instance_variable_set("@#{key}", val) if val
|
|
153
|
+
self.class.class_eval <<-EndEval
|
|
154
|
+
def #{key}
|
|
155
|
+
return @#{key} if @#{key}
|
|
156
|
+
raise MissingSetting, "Missing setting '#{key}' in #{@section}" unless has_key? '#{key}'
|
|
157
|
+
value = fetch('#{key}')
|
|
158
|
+
@#{key} = value.is_a?(Hash) ? self.class.new(value, "'#{key}' section in #{@section}") : value
|
|
159
|
+
end
|
|
160
|
+
EndEval
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
module Sunrise
|
|
3
|
+
module Utils
|
|
4
|
+
# Russian transliteration
|
|
5
|
+
#
|
|
6
|
+
module Transliteration
|
|
7
|
+
extend self
|
|
8
|
+
|
|
9
|
+
# Transliteration heavily based on rutils gem by Julian "julik" Tarkhanov and Co.
|
|
10
|
+
# <http://rutils.rubyforge.org/>
|
|
11
|
+
# Cleaned up and optimized.
|
|
12
|
+
|
|
13
|
+
LOWER_SINGLE = {
|
|
14
|
+
"і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e",
|
|
15
|
+
"ї"=>"yi","а"=>"a","б"=>"b",
|
|
16
|
+
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
|
|
17
|
+
"з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
|
|
18
|
+
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
|
|
19
|
+
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
|
|
20
|
+
"ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
|
|
21
|
+
"ы"=>"y","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya",
|
|
22
|
+
}
|
|
23
|
+
LOWER_MULTI = {
|
|
24
|
+
"ье"=>"ie",
|
|
25
|
+
"ьё"=>"ie",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
UPPER_SINGLE = {
|
|
29
|
+
"Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
|
|
30
|
+
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
|
|
31
|
+
"Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
|
|
32
|
+
"Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
|
|
33
|
+
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
|
|
34
|
+
"У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
|
|
35
|
+
"Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"Y","Ь"=>"",
|
|
36
|
+
"Э"=>"E","Ю"=>"YU","Я"=>"YA",
|
|
37
|
+
}
|
|
38
|
+
UPPER_MULTI = {
|
|
39
|
+
"ЬЕ"=>"IE",
|
|
40
|
+
"ЬЁ"=>"IE",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
LOWER = (LOWER_SINGLE.merge(LOWER_MULTI)).freeze
|
|
44
|
+
UPPER = (UPPER_SINGLE.merge(UPPER_MULTI)).freeze
|
|
45
|
+
MULTI_KEYS = (LOWER_MULTI.merge(UPPER_MULTI)).keys.sort_by {|s| s.length}.reverse.freeze
|
|
46
|
+
|
|
47
|
+
# Transliterate a string with russian characters
|
|
48
|
+
#
|
|
49
|
+
# Возвращает строку, в которой все буквы русского алфавита заменены на похожую по звучанию латиницу
|
|
50
|
+
def transliterate(str)
|
|
51
|
+
chars = str.scan(%r{#{MULTI_KEYS.join '|'}|\w|.})
|
|
52
|
+
|
|
53
|
+
result = ""
|
|
54
|
+
|
|
55
|
+
chars.each_with_index do |char, index|
|
|
56
|
+
if UPPER.has_key?(char) && LOWER.has_key?(chars[index+1])
|
|
57
|
+
# combined case
|
|
58
|
+
result << UPPER[char].downcase.capitalize
|
|
59
|
+
elsif UPPER.has_key?(char)
|
|
60
|
+
result << UPPER[char]
|
|
61
|
+
elsif LOWER.has_key?(char)
|
|
62
|
+
result << LOWER[char]
|
|
63
|
+
else
|
|
64
|
+
result << char
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
result
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'simple_form'
|
|
2
|
+
require 'sunrise/views/inputs/date_time_input'
|
|
3
|
+
|
|
4
|
+
module Sunrise
|
|
5
|
+
module Views
|
|
6
|
+
class FormBuilder < ::SimpleForm::FormBuilder
|
|
7
|
+
delegate :concat, :content_tag, :link_to, :link_to_function, :to => :template
|
|
8
|
+
|
|
9
|
+
def input(attribute_name, options = {}, &block)
|
|
10
|
+
options[:input_html] ||= {}
|
|
11
|
+
options[:input_html] = { :class => 'text' }.merge(options[:input_html])
|
|
12
|
+
|
|
13
|
+
attribute_name = "#{attribute_name}_#{options[:locale]}" unless options[:locale].blank?
|
|
14
|
+
|
|
15
|
+
super(attribute_name, options, &block)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def globalize(options={}, &block)
|
|
19
|
+
locales = options[:locales] || Sunrise.available_locales
|
|
20
|
+
html = []
|
|
21
|
+
|
|
22
|
+
html.join.html_safe
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def button(type, *args, &block)
|
|
26
|
+
options = args.extract_options!
|
|
27
|
+
url = options[:url] || [:manage, object_plural]
|
|
28
|
+
title = object.new_record? ? I18n.t('manage.create') : I18n.t('manage.update')
|
|
29
|
+
|
|
30
|
+
content_tag(:div, :style => "padding: 20px 0px 10px 20px;", :class => "buts") do
|
|
31
|
+
concat link_to_function content_tag(:span, title), "$(this).parents('form').submit()", :class=>"gr"
|
|
32
|
+
concat link_to I18n.t('manage.cancel'), url, :class=>"erase"
|
|
33
|
+
concat super(type, {:style => "display:none"}, &block)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
protected
|
|
38
|
+
|
|
39
|
+
def object_plural
|
|
40
|
+
object_name.to_s.pluralize
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
module Sunrise
|
|
2
|
+
module Views
|
|
3
|
+
module Helpers
|
|
4
|
+
|
|
5
|
+
def title(content)
|
|
6
|
+
content_for(:title) { content } unless content.blank?
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def javascript(*args)
|
|
10
|
+
content_for(:head) { javascript_include_tag(*args) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def stylesheet(*args)
|
|
14
|
+
content_for(:head) { stylesheet_link_tag(*args) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def description(content)
|
|
18
|
+
content_for(:description) { tag(:meta, :content=>content, :name=>"description") } unless content.blank?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def keywords(content)
|
|
22
|
+
content_for(:keywords) { tag(:meta, :content=>content, :name=>"keywords") } unless content.blank?
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def render_title
|
|
26
|
+
@page_title || I18n.t("page.title")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def render_keywords
|
|
30
|
+
@page_keywords || I18n.t("page.keywords")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def render_description
|
|
34
|
+
@page_description || I18n.t("page.description")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def anchor_to(name, options={})
|
|
38
|
+
return if name.blank?
|
|
39
|
+
options[:name] = name
|
|
40
|
+
|
|
41
|
+
content_tag(:a, '', options)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def link_by_href(name, options={})
|
|
45
|
+
link_to name, name, options
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def link_to_unless_current_span(name, options = {}, html_options = {}, &block)
|
|
49
|
+
link_to_unless_span current_page?(options), name, options, html_options, &block
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def link_to_unless_span(condition, name, options = {}, html_options = {}, &block)
|
|
53
|
+
if condition
|
|
54
|
+
if block_given?
|
|
55
|
+
block.arity <= 1 ? yield(name) : yield(name, options, html_options)
|
|
56
|
+
else
|
|
57
|
+
content_tag(:span, name, html_options)
|
|
58
|
+
end
|
|
59
|
+
else
|
|
60
|
+
link_to(name, options, html_options)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def link_to_unless_current_tag(name, options = {}, html_options = {}, &block)
|
|
65
|
+
link_to_unless_tag current_page?(options), name, options, html_options, &block
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def link_to_if_tag(condition, name, options = {}, html_options = {}, &block)
|
|
69
|
+
tag_name = html_options.delete(:tag) || :span
|
|
70
|
+
if condition
|
|
71
|
+
link_to(name, options, html_options)
|
|
72
|
+
else
|
|
73
|
+
if block_given?
|
|
74
|
+
block.arity <= 1 ? yield(name) : yield(name, options, html_options)
|
|
75
|
+
else
|
|
76
|
+
content_tag(tag_name, name, html_options)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def link_to_unless_tag(condition, name, options = {}, html_options = {}, &block)
|
|
82
|
+
tag_name = html_options.delete(:tag) || :span
|
|
83
|
+
unless condition
|
|
84
|
+
link_to(name, options, html_options)
|
|
85
|
+
else
|
|
86
|
+
if block_given?
|
|
87
|
+
block.arity <= 1 ? yield(name) : yield(name, options, html_options)
|
|
88
|
+
else
|
|
89
|
+
content_tag(tag_name, name, html_options)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def link_to_remote_if(condition, name, options = {}, html_options = nil)
|
|
95
|
+
return name unless condition
|
|
96
|
+
link_to_function(name, remote_function(options), html_options || options.delete(:html))
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def submit_image(name, src, options={})
|
|
100
|
+
html_options = options.dup.symbolize_keys
|
|
101
|
+
|
|
102
|
+
html_options[:name] = name
|
|
103
|
+
html_options[:src] = src
|
|
104
|
+
html_options[:type] ||= 'image'
|
|
105
|
+
|
|
106
|
+
tag(:input, html_options)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def submit_image_to_remote(name, value, options = {})
|
|
110
|
+
options[:with] ||= 'Form.serialize(this.form)'
|
|
111
|
+
|
|
112
|
+
html_options = options.delete(:html) || {}
|
|
113
|
+
html_options[:name] = name
|
|
114
|
+
html_options[:type] ||= 'button'
|
|
115
|
+
|
|
116
|
+
onclick = html_options.delete(:onclick) || remote_function(options)
|
|
117
|
+
|
|
118
|
+
tag(:input, html_options.merge(:value => name, :onclick => onclick))
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def locale_image_tag(source, options = {})
|
|
122
|
+
source = "#{I18n.locale}/#{source}"
|
|
123
|
+
image_tag(source, options)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# swf_object
|
|
127
|
+
def swf_object(swf, id, width, height, flash_version, options = {})
|
|
128
|
+
options.symbolize_keys!
|
|
129
|
+
|
|
130
|
+
params = options.delete(:params) || {}
|
|
131
|
+
attributes = options.delete(:attributes) || {}
|
|
132
|
+
flashvars = options.delete(:flashvars) || {}
|
|
133
|
+
|
|
134
|
+
attributes[:classid] ||= "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
|
|
135
|
+
attributes[:id] ||= id
|
|
136
|
+
attributes[:name] ||= id
|
|
137
|
+
|
|
138
|
+
output_buffer = ActiveSupport::SafeBuffer.new
|
|
139
|
+
|
|
140
|
+
if options[:create_div]
|
|
141
|
+
output_buffer << content_tag(:div,
|
|
142
|
+
"This website requires <a href='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW' target='_blank'>Flash player</a> #{flash_version} or higher.",
|
|
143
|
+
:id => id)
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
js = []
|
|
147
|
+
|
|
148
|
+
js << "var params = {#{params.to_a.map{|item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
|
|
149
|
+
js << "var attributes = {#{attributes.to_a.map{|item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
|
|
150
|
+
js << "var flashvars = {#{flashvars.to_a.map{|item| "#{item[0]}:'#{item[1]}'" }.join(',')}};"
|
|
151
|
+
|
|
152
|
+
js << "swfobject.embedSWF('#{swf}', '#{id}', '#{width}', '#{height}', '#{flash_version}', '/swf/expressInstall.swf', flashvars, params, attributes);"
|
|
153
|
+
|
|
154
|
+
output_buffer << javascript_tag(js.join)
|
|
155
|
+
|
|
156
|
+
output_buffer
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def encode_email(email_address, options = {})
|
|
160
|
+
email_address = email_address.to_s
|
|
161
|
+
string = ''
|
|
162
|
+
|
|
163
|
+
"document.write('#{email_address}');".each_byte do |c|
|
|
164
|
+
string << sprintf("%%%x", c)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
"<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>"
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def record_asset_tag(record, method_name, default_image, options = {})
|
|
171
|
+
asset = record ? record.send(method_name) : nil
|
|
172
|
+
asset_type = options.has_key?(:type) ? options.delete(:type).to_sym : nil
|
|
173
|
+
extname = File.extname(default_image)
|
|
174
|
+
image_path = asset_type.nil? ? default_image : "#{File.basename(default_image, extname)}_#{asset_type}#{extname}"
|
|
175
|
+
image_full = default_image.gsub(File.basename(default_image), image_path)
|
|
176
|
+
|
|
177
|
+
path = (asset && !asset.new_record?) ? asset.url(asset_type) : image_full
|
|
178
|
+
|
|
179
|
+
image_tag(path, options)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def manage_form_for(object, *args, &block)
|
|
183
|
+
options = args.extract_options!
|
|
184
|
+
options[:builder] ||= Sunrise::Views::FormBuilder
|
|
185
|
+
|
|
186
|
+
simple_form_for([:manage, object].flatten, *(args << options), &block)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module SimpleForm
|
|
2
|
+
module Inputs
|
|
3
|
+
class DateTimeInput < Base
|
|
4
|
+
def input
|
|
5
|
+
#@builder.send(:"#{input_type}_select", attribute_name, input_options, input_html_options)
|
|
6
|
+
html = [@builder.text_field(attribute_name, input_html_options)]
|
|
7
|
+
|
|
8
|
+
html << case input_type
|
|
9
|
+
when :date then
|
|
10
|
+
@builder.javascript_tag("$(function() {
|
|
11
|
+
$('##{@builder.object_name}_#{attribute_name}').datepicker({
|
|
12
|
+
numberOfMonths: 2,
|
|
13
|
+
showButtonPanel: true
|
|
14
|
+
});
|
|
15
|
+
});")
|
|
16
|
+
when :datetime then
|
|
17
|
+
@builder.javascript_tag("$(function() {
|
|
18
|
+
$('##{@builder.object_name}_#{attribute_name}').datetimepicker({
|
|
19
|
+
numberOfMonths: 2,
|
|
20
|
+
hourGrid: 4,
|
|
21
|
+
minuteGrid: 10
|
|
22
|
+
});
|
|
23
|
+
});")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
html.join.html_safe
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
def has_required?
|
|
32
|
+
false
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def label_target
|
|
36
|
+
case input_type
|
|
37
|
+
when :date, :datetime
|
|
38
|
+
"#{attribute_name}_1i"
|
|
39
|
+
when :time
|
|
40
|
+
"#{attribute_name}_4i"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
data/lib/sunrise-core.rb
ADDED