loyal_core 0.0.1

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.
Files changed (139) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +3 -0
  3. data/Rakefile +27 -0
  4. data/app/assets/images/loyal_core/down_rating.gif +0 -0
  5. data/app/assets/images/loyal_core/fallbacks/loyal_core/skin/recipe/avatar/ico_missing.gif +0 -0
  6. data/app/assets/images/loyal_core/fallbacks/loyal_core/skin/recipe/avatar/medium_missing.gif +0 -0
  7. data/app/assets/images/loyal_core/fallbacks/loyal_core/skin/recipe/avatar/mini_missing.gif +0 -0
  8. data/app/assets/images/loyal_core/fallbacks/loyal_core/skin/recipe/avatar/missing.gif +0 -0
  9. data/app/assets/images/loyal_core/fallbacks/loyal_core/skin/recipe/avatar/small_missing.gif +0 -0
  10. data/app/assets/images/loyal_core/fallbacks/loyal_core/skin/recipe/avatar/thumb_missing.gif +0 -0
  11. data/app/assets/images/loyal_core/fallbacks/loyal_core/skin/recipe/avatar/tiny_missing.gif +0 -0
  12. data/app/assets/images/loyal_core/fallbacks/user/avatar/ico_missing.gif +0 -0
  13. data/app/assets/images/loyal_core/fallbacks/user/avatar/medium_missing.gif +0 -0
  14. data/app/assets/images/loyal_core/fallbacks/user/avatar/mini_missing.gif +0 -0
  15. data/app/assets/images/loyal_core/fallbacks/user/avatar/missing.gif +0 -0
  16. data/app/assets/images/loyal_core/fallbacks/user/avatar/small_missing.gif +0 -0
  17. data/app/assets/images/loyal_core/fallbacks/user/avatar/thumb_missing.gif +0 -0
  18. data/app/assets/images/loyal_core/fallbacks/user/avatar/tiny_missing.gif +0 -0
  19. data/app/assets/images/loyal_core/liked.gif +0 -0
  20. data/app/assets/images/loyal_core/unlike.gif +0 -0
  21. data/app/assets/images/loyal_core/up_rating.gif +0 -0
  22. data/app/assets/javascripts/jquery.cookie.js +95 -0
  23. data/app/assets/javascripts/loyal_core/admin/skin/folders.js +2 -0
  24. data/app/assets/javascripts/loyal_core/admin/skin/recipes.js +2 -0
  25. data/app/assets/javascripts/loyal_core/ajax/captchas.js +2 -0
  26. data/app/assets/javascripts/loyal_core/ajax/like_tracks.js +2 -0
  27. data/app/assets/javascripts/loyal_core/ajax/rating_tracks.js +3 -0
  28. data/app/assets/javascripts/loyal_core/ajax/users/sessions.js +2 -0
  29. data/app/assets/javascripts/loyal_core/ajax.js +124 -0
  30. data/app/assets/javascripts/loyal_core/application.js +6 -0
  31. data/app/assets/javascripts/loyal_core/jumps.js +2 -0
  32. data/app/assets/javascripts/loyal_core/tools/append_params_return_to.js +21 -0
  33. data/app/assets/javascripts/loyal_core/tools/editor_content_mode_selector.js +8 -0
  34. data/app/assets/javascripts/loyal_core/tools/font_selector.js +83 -0
  35. data/app/assets/stylesheets/loyal_core/admin/skin/folders.css +4 -0
  36. data/app/assets/stylesheets/loyal_core/admin/skin/recipes.css +4 -0
  37. data/app/assets/stylesheets/loyal_core/ajax/captchas.css +4 -0
  38. data/app/assets/stylesheets/loyal_core/ajax/like_tracks.css +4 -0
  39. data/app/assets/stylesheets/loyal_core/ajax/rating_tracks.css +4 -0
  40. data/app/assets/stylesheets/loyal_core/ajax/users/sessions.css +4 -0
  41. data/app/assets/stylesheets/loyal_core/application.css.scss +18 -0
  42. data/app/assets/stylesheets/loyal_core/jumps.css +4 -0
  43. data/app/controllers/loyal_core/admin/skin/folders_controller.rb +54 -0
  44. data/app/controllers/loyal_core/admin/skin/recipes_controller.rb +52 -0
  45. data/app/controllers/loyal_core/ajax/captchas_controller.rb +26 -0
  46. data/app/controllers/loyal_core/ajax/like_tracks_controller.rb +33 -0
  47. data/app/controllers/loyal_core/ajax/rating_tracks_controller.rb +41 -0
  48. data/app/controllers/loyal_core/ajax/users/sessions_controller.rb +8 -0
  49. data/app/controllers/loyal_core/ajax_controller.rb +14 -0
  50. data/app/controllers/loyal_core/application_controller.rb +6 -0
  51. data/app/controllers/loyal_core/jumps_controller.rb +10 -0
  52. data/app/helpers/loyal_core/admin/skin/folders_helper.rb +5 -0
  53. data/app/helpers/loyal_core/admin/skin/recipes_helper.rb +5 -0
  54. data/app/helpers/loyal_core/ajax/captchas_helper.rb +6 -0
  55. data/app/helpers/loyal_core/ajax/like_tracks_helper.rb +6 -0
  56. data/app/helpers/loyal_core/ajax/rating_tracks_helper.rb +6 -0
  57. data/app/helpers/loyal_core/ajax/users/sessions_helper.rb +5 -0
  58. data/app/helpers/loyal_core/application_helper.rb +6 -0
  59. data/app/helpers/loyal_core/jumps_helper.rb +5 -0
  60. data/app/models/kindeditor/asset.rb +14 -0
  61. data/app/models/kindeditor/file.rb +4 -0
  62. data/app/models/kindeditor/flash.rb +4 -0
  63. data/app/models/kindeditor/image.rb +4 -0
  64. data/app/models/kindeditor/media.rb +4 -0
  65. data/app/models/loyal_core/like_track.rb +15 -0
  66. data/app/models/loyal_core/rating_track.rb +32 -0
  67. data/app/models/loyal_core/skin/dish.rb +10 -0
  68. data/app/models/loyal_core/skin/folder.rb +26 -0
  69. data/app/models/loyal_core/skin/recipe.rb +31 -0
  70. data/app/models/loyal_core/skin.rb +8 -0
  71. data/app/uploaders/loyal_core/asset_uploader.rb +128 -0
  72. data/app/uploaders/loyal_core/avatar_uploader.rb +37 -0
  73. data/app/views/layouts/loyal_core/application.html.erb +14 -0
  74. data/app/views/loyal_core/admin/skin/folders/_form.html.erb +9 -0
  75. data/app/views/loyal_core/admin/skin/folders/edit.html.erb +11 -0
  76. data/app/views/loyal_core/admin/skin/folders/index.html.erb +25 -0
  77. data/app/views/loyal_core/admin/skin/folders/new.html.erb +11 -0
  78. data/app/views/loyal_core/admin/skin/folders/show.html.erb +32 -0
  79. data/app/views/loyal_core/admin/skin/recipes/_form.html.erb +25 -0
  80. data/app/views/loyal_core/admin/skin/recipes/edit.html.erb +11 -0
  81. data/app/views/loyal_core/admin/skin/recipes/index.html.erb +37 -0
  82. data/app/views/loyal_core/admin/skin/recipes/new.html.erb +11 -0
  83. data/app/views/loyal_core/admin/skin/recipes/show.html.erb +16 -0
  84. data/app/views/loyal_core/ajax/captchas/_new.html.erb +1 -0
  85. data/app/views/loyal_core/ajax/captchas/new.html.erb +1 -0
  86. data/app/views/loyal_core/jumps/show.html.erb +12 -0
  87. data/app/views/simple_captcha/_simple_captcha.erb +16 -0
  88. data/config/locales/en/default.en.yml +139 -0
  89. data/config/locales/en/loyal_simple_captcha.en.yml +8 -0
  90. data/config/locales/zh-CN/action_view.zh-CN.yml +8 -0
  91. data/config/locales/zh-CN/default.zh-CN.yml +199 -0
  92. data/config/locales/zh-CN/loyal_simple_captcha.zh-CN.yml +8 -0
  93. data/config/locales/zh-CN/paginate.zh-CN.yml +8 -0
  94. data/config/routes.rb +24 -0
  95. data/db/migrate/20130331104216_create_loyal_core_rating_tracks.rb +19 -0
  96. data/db/migrate/20130331104822_create_loyal_core_like_tracks.rb +19 -0
  97. data/db/migrate/20130413061851_create_kindeditor_assets.rb +17 -0
  98. data/db/migrate/20130610091558_create_loyal_core_skin_folders.rb +48 -0
  99. data/db/migrate/20130610095635_create_loyal_core_skin_recipes.rb +28 -0
  100. data/db/migrate/20130610095938_create_loyal_core_skin_dishes.rb +13 -0
  101. data/lib/loyal_core/action_controller/request_init.rb +33 -0
  102. data/lib/loyal_core/action_controller/seo_methods.rb +47 -0
  103. data/lib/loyal_core/action_controller.rb +4 -0
  104. data/lib/loyal_core/action_helper/ajax/like_tracks_helper.rb +26 -0
  105. data/lib/loyal_core/action_helper/ajax/rating_tracks_helper.rb +35 -0
  106. data/lib/loyal_core/action_helper/font_selector_helper.rb +25 -0
  107. data/lib/loyal_core/action_helper.rb +27 -0
  108. data/lib/loyal_core/action_view/labeled_builder.rb +127 -0
  109. data/lib/loyal_core/action_view.rb +7 -0
  110. data/lib/loyal_core/active_model/fix_counter_cache.rb +39 -0
  111. data/lib/loyal_core/active_model/human_display_able.rb +26 -0
  112. data/lib/loyal_core/active_model/strip_whitespace.rb +27 -0
  113. data/lib/loyal_core/active_model.rb +16 -0
  114. data/lib/loyal_core/acts/bit_able.rb +139 -0
  115. data/lib/loyal_core/acts/content_depart_able.rb +102 -0
  116. data/lib/loyal_core/acts/content_mode_able.rb +88 -0
  117. data/lib/loyal_core/acts/has_avatar.rb +31 -0
  118. data/lib/loyal_core/acts/has_permalink.rb +43 -0
  119. data/lib/loyal_core/acts/like_track_able.rb +90 -0
  120. data/lib/loyal_core/acts/named_filter_able.rb +40 -0
  121. data/lib/loyal_core/acts/rating_track_able.rb +76 -0
  122. data/lib/loyal_core/acts/skin_dish_able.rb +56 -0
  123. data/lib/loyal_core/acts/tree.rb +104 -0
  124. data/lib/loyal_core/acts/uuid_ful.rb +39 -0
  125. data/lib/loyal_core/acts/views_count_able.rb +33 -0
  126. data/lib/loyal_core/acts.rb +35 -0
  127. data/lib/loyal_core/config.rb +116 -0
  128. data/lib/loyal_core/core_ext/singleton_class.rb +9 -0
  129. data/lib/loyal_core/engine.rb +11 -0
  130. data/lib/loyal_core/memoist.rb +204 -0
  131. data/lib/loyal_core/utils/array_util.rb +16 -0
  132. data/lib/loyal_core/utils/config_util.rb +186 -0
  133. data/lib/loyal_core/utils/data_util.rb +181 -0
  134. data/lib/loyal_core/utils/text_util.rb +49 -0
  135. data/lib/loyal_core/utils.rb +8 -0
  136. data/lib/loyal_core/version.rb +4 -0
  137. data/lib/loyal_core.rb +17 -0
  138. data/lib/tasks/loyal_core_tasks.rake +11 -0
  139. metadata +231 -0
@@ -0,0 +1,37 @@
1
+ <h1>皮肤列表</h1>
2
+
3
+ <%= paginate @loyal_core_skin_recipes %>
4
+
5
+ <table>
6
+ <tr>
7
+ <th>ID</th>
8
+ <th>文章标题</th>
9
+ <th>作者</th>
10
+ <th>操作</th>
11
+ </tr>
12
+ <% if @loyal_core_skin_recipes.to_a.any? %>
13
+ <% @loyal_core_skin_recipes.each do |recipe| %>
14
+ <tr>
15
+ <td><%= recipe.id %></td>
16
+ <td><%= link_to "#{recipe.name}", loyal_core_app.admin_skin_recipe_url(:id => recipe.id) %></td>
17
+ <td>
18
+ <% if recipe.creator %>
19
+ <%= link_to "#{recipe.creator.nick_name}", loyal_passport_app.admin_user_url(:id => recipe.creator.id) %>
20
+ <% else %>
21
+ 未知
22
+ <% end %>
23
+ </td>
24
+ <td>
25
+ <%= link_to "编辑", loyal_core_app.edit_admin_skin_recipe_url(:id => recipe.id) %>
26
+ <%= link_to "删除", loyal_core_app.admin_skin_recipe_url(:id => recipe.id), :method => :delete, :confirm => '确定要删除吗?' %>
27
+ </td>
28
+ </tr>
29
+ <% end %>
30
+ <% else %>
31
+ 列表为空
32
+ <% end %>
33
+ </table>
34
+
35
+ <%= paginate @loyal_core_skin_recipes %>
36
+
37
+ <%= link_to "new", loyal_core_app.new_admin_skin_recipe_url %>
@@ -0,0 +1,11 @@
1
+ <h1>新建新皮肤</h1>
2
+
3
+ <%= form_for(
4
+ @loyal_core_skin_recipe,
5
+ :url => loyal_core_app.admin_skin_recipes_url,
6
+ :builder => ::LoyalCore::ActionView::LabeledBuilder,
7
+ :as => :loyal_core_skin_recipe
8
+ ) do |f| %>
9
+ <%= render :partial => 'form', :locals => { :f => f } %>
10
+ <% end %>
11
+
@@ -0,0 +1,16 @@
1
+ <h1>【皮肤】 <%= @loyal_core_skin_recipe.name %></h1>
2
+
3
+ <div>
4
+ <b>短标题</b><%= @loyal_core_skin_recipe.short_name %><br/>
5
+ <b>路径</b><%= @loyal_core_skin_recipe.assets_path %><br/>
6
+ <b>样式表</b><%= @loyal_core_skin_recipe.stylesheet_text %><br/>
7
+ <b>简介</b><%= @loyal_core_skin_recipe.instroduction %><br/>
8
+ <b>描述</b><%= @loyal_core_skin_recipe.description %><br/>
9
+
10
+ <b>描述</b>
11
+ <%= image_tag @loyal_core_skin_recipe.avatar.url(:small) %>
12
+ </div>
13
+
14
+
15
+ <%= link_to "编辑", loyal_core_app.edit_admin_skin_recipe_url(:id => @loyal_core_skin_recipe.id) %>
16
+ <%= link_to "返回列表", loyal_core_app.admin_skin_recipes_url %>
@@ -0,0 +1 @@
1
+ <%= show_simple_captcha options %>
@@ -0,0 +1 @@
1
+ <%= show_simple_captcha @simple_captcha_options %>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5
+ <title>redirect</title>
6
+ <meta http-equiv="refresh" content="0;url=<%= params[:url] %>">
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ </body>
12
+ </html>
@@ -0,0 +1,16 @@
1
+ <div class='simple_captcha'>
2
+ <span class='simple_captcha_image'>
3
+ <%= simple_captcha_options[:image] %>
4
+ <%= link_to I18n.t('simple_captcha.retry'),
5
+ "javascript:;",
6
+ :onclick => "marchBackstage.retrySimpleCaptcha(this, \'#{j loyal_core_app.new_ajax_core_captcha_url}\');",
7
+ :class => 'retry'
8
+ %>
9
+ </span>
10
+
11
+ <span class='simple_captcha_field'>
12
+ <%= simple_captcha_options[:field] %>
13
+ </span>
14
+ </div>
15
+
16
+
@@ -0,0 +1,139 @@
1
+ # # Sample localization file for English. Add more files in this directory for other locales.
2
+ # # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+ #
4
+ # en:
5
+ # hello: "Hello world"
6
+
7
+ en:
8
+ date:
9
+ formats:
10
+ # Use the strftime parameters for formats.
11
+ # When no format has been given, it uses default.
12
+ # You can provide other formats here if you like!
13
+ default: "%Y-%m-%d"
14
+ short: "%b %d"
15
+ long: "%B %d, %Y"
16
+
17
+ day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
18
+ abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
19
+
20
+ # Don't forget the nil at the beginning; there's no such thing as a 0th month
21
+ month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
22
+ abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
23
+ # Used in date_select and datetime_select.
24
+ order:
25
+ - :year
26
+ - :month
27
+ - :day
28
+
29
+ time:
30
+ formats:
31
+ default: "%a, %d %b %Y %H:%M:%S %z"
32
+ short: "%d %b %H:%M"
33
+ long: "%B %d, %Y %H:%M"
34
+ am: "am"
35
+ pm: "pm"
36
+
37
+ # Used in array.to_sentence.
38
+ support:
39
+ array:
40
+ words_connector: ", "
41
+ two_words_connector: " and "
42
+ last_word_connector: ", and "
43
+ number:
44
+ # Used in NumberHelper.number_to_delimited()
45
+ # These are also the defaults for 'currency', 'percentage', 'precision', and 'human'
46
+ format:
47
+ # Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5)
48
+ separator: "."
49
+ # Delimits thousands (e.g. 1,000,000 is a million) (always in groups of three)
50
+ delimiter: ","
51
+ # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
52
+ precision: 3
53
+ # If set to true, precision will mean the number of significant digits instead
54
+ # of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)
55
+ significant: false
56
+ # If set, the zeros after the decimal separator will always be stripped (eg.: 1.200 will be 1.2)
57
+ strip_insignificant_zeros: false
58
+
59
+ # Used in NumberHelper.number_to_currency()
60
+ currency:
61
+ format:
62
+ # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00)
63
+ format: "%u%n"
64
+ unit: "$"
65
+ # These five are to override number.format and are optional
66
+ separator: "."
67
+ delimiter: ","
68
+ precision: 2
69
+ significant: false
70
+ strip_insignificant_zeros: false
71
+
72
+ # Used in NumberHelper.number_to_percentage()
73
+ percentage:
74
+ format:
75
+ # These five are to override number.format and are optional
76
+ # separator:
77
+ delimiter: ""
78
+ # precision:
79
+ # significant: false
80
+ # strip_insignificant_zeros: false
81
+ format: "%n%"
82
+
83
+ # Used in NumberHelper.number_to_rounded()
84
+ precision:
85
+ format:
86
+ # These five are to override number.format and are optional
87
+ # separator:
88
+ delimiter: ""
89
+ # precision:
90
+ # significant: false
91
+ # strip_insignificant_zeros: false
92
+
93
+ # Used in NumberHelper.number_to_human_size() and NumberHelper.number_to_human()
94
+ human:
95
+ format:
96
+ # These five are to override number.format and are optional
97
+ # separator:
98
+ delimiter: ""
99
+ precision: 3
100
+ significant: true
101
+ strip_insignificant_zeros: true
102
+ # Used in number_to_human_size()
103
+ storage_units:
104
+ # Storage units output formatting.
105
+ # %u is the storage unit, %n is the number (default: 2 MB)
106
+ format: "%n %u"
107
+ units:
108
+ byte:
109
+ one: "Byte"
110
+ other: "Bytes"
111
+ kb: "KB"
112
+ mb: "MB"
113
+ gb: "GB"
114
+ tb: "TB"
115
+ # Used in NumberHelper.number_to_human()
116
+ decimal_units:
117
+ format: "%n %u"
118
+ # Decimal units output formatting
119
+ # By default we will only quantify some of the exponents
120
+ # but the commented ones might be defined or overridden
121
+ # by the user.
122
+ units:
123
+ # femto: Quadrillionth
124
+ # pico: Trillionth
125
+ # nano: Billionth
126
+ # micro: Millionth
127
+ # mili: Thousandth
128
+ # centi: Hundredth
129
+ # deci: Tenth
130
+ unit: ""
131
+ # ten:
132
+ # one: Ten
133
+ # other: Tens
134
+ # hundred: Hundred
135
+ thousand: Thousand
136
+ million: Million
137
+ billion: Billion
138
+ trillion: Trillion
139
+ quadrillion: Quadrillion
@@ -0,0 +1,8 @@
1
+ zh-CN:
2
+ simple_captcha:
3
+ label: 'Please input captcha'
4
+ placeholder: 'Captcha'
5
+ message:
6
+ default: "Secret Code did not match with the Image"
7
+ user: "The secret Image and code were different"
8
+
@@ -0,0 +1,8 @@
1
+ zh-CN:
2
+ loyal_core:
3
+ action_view:
4
+ form_builder:
5
+ submit:
6
+ disable_with: '正在提交...'
7
+ default_value: '提交'
8
+
@@ -0,0 +1,199 @@
1
+ # -*- encoding : utf-8 -*-
2
+ zh-CN:
3
+ hello: '您好!'
4
+ date:
5
+ abbr_day_names:
6
+ - 日
7
+ - 一
8
+ - 二
9
+ - 三
10
+ - 四
11
+ - 五
12
+ - 六
13
+ abbr_month_names:
14
+ -
15
+ - 1月
16
+ - 2月
17
+ - 3月
18
+ - 4月
19
+ - 5月
20
+ - 6月
21
+ - 7月
22
+ - 8月
23
+ - 9月
24
+ - 10月
25
+ - 11月
26
+ - 12月
27
+ day_names:
28
+ - 星期日
29
+ - 星期一
30
+ - 星期二
31
+ - 星期三
32
+ - 星期四
33
+ - 星期五
34
+ - 星期六
35
+ formats:
36
+ default: ! '%Y-%m-%d'
37
+ long: ! '%Y年%b%d日'
38
+ short: ! '%b%d日'
39
+ month_names:
40
+ -
41
+ - 一月
42
+ - 二月
43
+ - 三月
44
+ - 四月
45
+ - 五月
46
+ - 六月
47
+ - 七月
48
+ - 八月
49
+ - 九月
50
+ - 十月
51
+ - 十一月
52
+ - 十二月
53
+ order:
54
+ - :year
55
+ - :month
56
+ - :day
57
+ datetime:
58
+ distance_in_words:
59
+ about_x_hours:
60
+ one: 大约一小时
61
+ other: 大约 %{count} 小时
62
+ about_x_months:
63
+ one: 大约一个月
64
+ other: 大约 %{count} 个月
65
+ about_x_years:
66
+ one: 大约一年
67
+ other: 大约 %{count} 年
68
+ almost_x_years:
69
+ one: 接近一年
70
+ other: 接近 %{count} 年
71
+ half_a_minute: 半分钟
72
+ less_than_x_minutes:
73
+ one: 不到一分钟
74
+ other: 不到 %{count} 分钟
75
+ less_than_x_seconds:
76
+ one: 不到一秒
77
+ other: 不到 %{count} 秒
78
+ over_x_years:
79
+ one: 一年多
80
+ other: ! '%{count} 年多'
81
+ x_days:
82
+ one: 一天
83
+ other: ! '%{count} 天'
84
+ x_minutes:
85
+ one: 一分钟
86
+ other: ! '%{count} 分钟'
87
+ x_months:
88
+ one: 一个月
89
+ other: ! '%{count} 个月'
90
+ x_seconds:
91
+ one: 一秒
92
+ other: ! '%{count} 秒'
93
+ prompts:
94
+ day: 日
95
+ hour: 时
96
+ minute: 分
97
+ month: 月
98
+ second: 秒
99
+ year: 年
100
+ errors: &errors
101
+ format: ! '%{attribute} %{message}'
102
+ messages:
103
+ extension_white_list_error: '不支持该文件类型'
104
+ accepted: 必须是可被接受的
105
+ blank: 不能为空字符
106
+ confirmation: 与确认值不匹配
107
+ empty: 不能留空
108
+ equal_to: 必须等于 %{count}
109
+ even: 必须为双数
110
+ exclusion: 是保留关键字
111
+ greater_than: 必须大于 %{count}
112
+ greater_than_or_equal_to: 必须大于或等于 %{count}
113
+ inclusion: 不包含于列表中
114
+ invalid: 是无效的
115
+ less_than: 必须小于 %{count}
116
+ less_than_or_equal_to: 必须小于或等于 %{count}
117
+ not_a_number: 不是数字
118
+ not_an_integer: 必须是整数
119
+ odd: 必须为单数
120
+ record_invalid: ! '验证失败: %{errors}'
121
+ taken: 已经被使用
122
+ too_long: 过长(最长为 %{count} 个字符)
123
+ too_short: 过短(最短为 %{count} 个字符)
124
+ wrong_length: 长度非法(必须为 %{count} 个字符)
125
+ not_exist: 不存在
126
+ length_not_in_the_range: 长度必须在 %{min}-%{max} 之间
127
+ template:
128
+ body: 如下字段出现错误:
129
+ header:
130
+ one: 有 1 个错误发生导致「%{model}」无法被保存。
131
+ other: 有 %{count} 个错误发生导致「%{model}」无法被保存。
132
+ helpers:
133
+ select:
134
+ prompt: 请选择
135
+ submit:
136
+ create: 新建%{model}
137
+ submit: 储存%{model}
138
+ update: 更新%{model}
139
+ number:
140
+ currency:
141
+ format:
142
+ delimiter: ! ','
143
+ format: ! '%u %n'
144
+ precision: 2
145
+ separator: .
146
+ significant: false
147
+ strip_insignificant_zeros: false
148
+ unit: CN¥
149
+ format:
150
+ delimiter: ! ','
151
+ precision: 3
152
+ separator: .
153
+ significant: false
154
+ strip_insignificant_zeros: false
155
+ human:
156
+ decimal_units:
157
+ format: ! '%n %u'
158
+ units:
159
+ billion: 十亿
160
+ million: 百万
161
+ quadrillion: 千兆
162
+ thousand: 千
163
+ trillion: 兆
164
+ unit: ''
165
+ format:
166
+ delimiter: ''
167
+ precision: 1
168
+ significant: false
169
+ strip_insignificant_zeros: false
170
+ storage_units:
171
+ format: ! '%n %u'
172
+ units:
173
+ byte:
174
+ one: Byte
175
+ other: Bytes
176
+ gb: GB
177
+ kb: KB
178
+ mb: MB
179
+ tb: TB
180
+ percentage:
181
+ format:
182
+ delimiter: ''
183
+ precision:
184
+ format:
185
+ delimiter: ''
186
+ support:
187
+ array:
188
+ two_words_connector: ! ' 和 '
189
+ last_word_connector: ! ', 和 '
190
+ words_connector: ! ', '
191
+ time:
192
+ am: 上午
193
+ formats:
194
+ default: ! '%Y年%m月%d日 %H:%M'
195
+ long: ! '%Y年%m月%d日 %A %H:%M:%S %Z'
196
+ short: ! '%m月%d日 %H:%M'
197
+ mini: ! '%m.%d %H:%M'
198
+ pm: 下午
199
+
@@ -0,0 +1,8 @@
1
+ zh-CN:
2
+ simple_captcha:
3
+ label: '请输验证码'
4
+ placeholder: '请输验证码'
5
+ retry: '看不清? 重新获取'
6
+ message:
7
+ default: "不正确"
8
+
@@ -0,0 +1,8 @@
1
+ zh-CN:
2
+ views:
3
+ pagination:
4
+ first: "&laquo; 第一页"
5
+ last: "末页 &raquo;"
6
+ previous: "&lsaquo; 上一页"
7
+ next: "下一页 &rsaquo;"
8
+ truncate: "..."
data/config/routes.rb ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding : utf-8 -*-
2
+ LoyalCore::Engine.routes.draw do
3
+
4
+ scope :admin, :module => :admin, :as => :admin, :path => :loyal_core do
5
+ namespace :skin do
6
+ resources :folders
7
+ resources :recipes
8
+ end
9
+ end
10
+
11
+ namespace :ajax do
12
+ scope :core, :as => :core, :path => :core do
13
+ get "like_tracks/:target_type/:target_id/touch(.:format)" => "like_tracks#touch", :as => :touch_like_track
14
+ get "rating_tracks/:target_type/:target_id/up(.:format)" => "rating_tracks#up", :as => :up_rating_track
15
+ get "rating_tracks/:target_type/:target_id/down(.:format)" => "rating_tracks#down", :as => :down_rating_track
16
+
17
+
18
+ resources :captchas, :only => [:new]
19
+
20
+ # ajax_core_login_path
21
+ get "login(.:format)" => "users/sessions#new", :as => :login
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateLoyalCoreRatingTracks < ActiveRecord::Migration
3
+ def change
4
+ create_table :loyal_core_rating_tracks do |t|
5
+ t.references :target, :polymorphic => true
6
+ t.integer :created_by
7
+ t.string :created_ip
8
+ t.integer :score, :default => 0, :null => false
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :loyal_core_rating_tracks, [:created_by]
14
+
15
+ add_index :loyal_core_rating_tracks, [:target_id, :target_type],
16
+ :name => :loyal_core_rating_tracks_target
17
+
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateLoyalCoreLikeTracks < ActiveRecord::Migration
3
+ def change
4
+ create_table :loyal_core_like_tracks do |t|
5
+ t.references :target, :polymorphic => true
6
+ t.integer :created_by
7
+ t.string :created_ip
8
+ t.integer :position, :default => 0, :null => false
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :loyal_core_like_tracks, [:created_by]
14
+
15
+ add_index :loyal_core_like_tracks, [:target_id, :target_type],
16
+ :name => :loyal_core_like_tracks_target
17
+
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateKindeditorAssets < ActiveRecord::Migration
3
+ def self.up
4
+ create_table :kindeditor_assets do |t|
5
+ t.string :asset
6
+ t.string :file_name
7
+ t.integer :file_size
8
+ t.string :file_type
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :kindeditor_assets
15
+ end
16
+ end
17
+
@@ -0,0 +1,48 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateLoyalCoreSkinFolders < ActiveRecord::Migration
3
+ def change
4
+ create_table :loyal_core_skin_folders do |t|
5
+ t.string :name #名称
6
+ t.string :short_name #简称
7
+
8
+ t.integer :publish_status, :default => 0, :null => false
9
+
10
+ t.integer :created_by
11
+ t.string :created_ip
12
+
13
+ # 简介
14
+ t.string :instroduction
15
+
16
+ # 描述
17
+ t.text :description
18
+
19
+ t.integer :lang, default: 0, :null => false #语言
20
+
21
+ t.string :uuid
22
+
23
+ t.string :space #命名空间
24
+ t.string :permalink
25
+
26
+ ###### avatar #############################
27
+ t.string :avatar
28
+
29
+ ###### for nested_ful #####################
30
+ t.integer :parent_id
31
+ t.integer :left_id
32
+ t.integer :right_id
33
+ t.integer :depth
34
+ t.integer :children_count, default: 0
35
+
36
+ ##### soft deleted #######################
37
+ t.datetime :deleted_at
38
+
39
+ t.timestamps
40
+ end
41
+
42
+ add_index :loyal_core_skin_folders, [:uuid]
43
+ add_index :loyal_core_skin_folders, [:space, :permalink]
44
+ add_index :loyal_core_skin_folders, [:parent_id]
45
+ add_index :loyal_core_skin_folders, [:left_id]
46
+ add_index :loyal_core_skin_folders, [:right_id]
47
+ end
48
+ end
@@ -0,0 +1,28 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateLoyalCoreSkinRecipes < ActiveRecord::Migration
3
+ def change
4
+ create_table :loyal_core_skin_recipes do |t|
5
+ t.integer :folder_id
6
+
7
+ t.string :name
8
+ t.string :short_name
9
+
10
+ t.string :avatar
11
+ t.string :stored_tags
12
+
13
+ t.string :assets_path
14
+ t.text :stylesheet_text
15
+
16
+ t.integer :created_by
17
+ t.string :created_ip
18
+
19
+ # 简介
20
+ t.string :instroduction
21
+
22
+ # 描述
23
+ t.text :description
24
+
25
+ t.timestamps
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,13 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class CreateLoyalCoreSkinDishes < ActiveRecord::Migration
3
+ def change
4
+ create_table :loyal_core_skin_dishes do |t|
5
+
6
+ t.references :target, :polymorphic => true
7
+
8
+ t.integer :recipe_id
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,33 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module LoyalCore::ActionController
3
+ module RequestInit
4
+ def self.included base
5
+ base.class_eval do
6
+ before_filter do |controller|
7
+ request = controller.send :request
8
+
9
+ Rails.logger.debug " -> domain: #{request.domain}"
10
+ Rails.logger.debug " -> subdomain: #{request.subdomain}"
11
+ Rails.logger.debug " -> host: #{request.host}"
12
+ Rails.logger.debug " * Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}"
13
+ # I18n.locale = params[:locale] || extract_locale_from_accept_language_header || I18n.default_locale
14
+ I18n.locale = params[:locale] || I18n.default_locale
15
+ Rails.logger.debug " * Locale set to '#{I18n.locale}'"
16
+
17
+ Rails.logger.debug " * session: #{session.to_hash}"
18
+ end
19
+
20
+ include InstanceMethods
21
+ include ::LoyalCore::ActionController::SeoMethods
22
+ end
23
+ end
24
+
25
+ module InstanceMethods
26
+
27
+ end
28
+ end
29
+ end
30
+
31
+ if defined?(ActionController::Base)
32
+ ActionController::Base.send :include, ::LoyalCore::ActionController::RequestInit
33
+ end