rails_detail 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +165 -0
  3. data/README.md +3 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/config/rails_detail_manifest.js +3 -0
  6. data/app/assets/javascripts/controllers/rails_detail_my/contents/index.ready.js +1 -0
  7. data/app/assets/javascripts/controllers/rails_detail_my/entity_items/index.js +45 -0
  8. data/app/assets/javascripts/controllers/rails_detail_my/pictures/index.ready.js +18 -0
  9. data/app/assets/javascripts/knowledge.js +47 -0
  10. data/app/assets/javascripts/rails_detail/application.js +4 -0
  11. data/app/assets/stylesheets/rails_detail/application.css +14 -0
  12. data/app/controllers/rails_detail_admin/base_controller.rb +5 -0
  13. data/app/controllers/rails_detail_admin/items_controller.rb +76 -0
  14. data/app/controllers/rails_detail_admin/lists_controller.rb +60 -0
  15. data/app/controllers/rails_detail_my/base_controller.rb +7 -0
  16. data/app/controllers/rails_detail_my/entity_items_controller.rb +51 -0
  17. data/app/controllers/rails_detail_my/items_controller.rb +10 -0
  18. data/app/controllers/rails_detail_my/knowledges_controller.rb +124 -0
  19. data/app/controllers/rails_detail_my/majors_controller.rb +68 -0
  20. data/app/controllers/rails_detail_my/minors_controller.rb +64 -0
  21. data/app/controllers/rails_detail_my/notes_controller.rb +47 -0
  22. data/app/controllers/rails_detail_my/parts_controller.rb +74 -0
  23. data/app/controllers/rails_detail_my/pictures_controller.rb +76 -0
  24. data/app/controllers/rails_detail_my/sections_controller.rb +62 -0
  25. data/app/controllers/rails_detail_my/solos_controller.rb +96 -0
  26. data/app/controllers/rails_detail_my/sources_controller.rb +79 -0
  27. data/app/controllers/rails_detail_my/taxon_items_controller.rb +66 -0
  28. data/app/controllers/rails_detail_my/wikis_controller.rb +104 -0
  29. data/app/models/rails_detail/concerns/content_model.rb +13 -0
  30. data/app/models/rails_detail/concerns/item_model.rb +24 -0
  31. data/app/models/rails_detail/concerns/taxon_model.rb +9 -0
  32. data/app/models/rails_detail/content.rb +12 -0
  33. data/app/models/rails_detail/contents/banner.rb +7 -0
  34. data/app/models/rails_detail/contents/link.rb +5 -0
  35. data/app/models/rails_detail/contents/note.rb +6 -0
  36. data/app/models/rails_detail/contents/picture.rb +7 -0
  37. data/app/models/rails_detail/entity_item.rb +18 -0
  38. data/app/models/rails_detail/item.rb +7 -0
  39. data/app/models/rails_detail/list.rb +6 -0
  40. data/app/models/rails_detail/taxon_item.rb +14 -0
  41. data/app/views/layouts/the_detail.html.erb +22 -0
  42. data/app/views/rails_detail_admin/answers/_answer.html.erb +14 -0
  43. data/app/views/rails_detail_admin/answers/_form.html.erb +16 -0
  44. data/app/views/rails_detail_admin/answers/edit.html.erb +11 -0
  45. data/app/views/rails_detail_admin/answers/index.html.erb +31 -0
  46. data/app/views/rails_detail_admin/answers/new.html.erb +22 -0
  47. data/app/views/rails_detail_admin/answers/show.html.erb +19 -0
  48. data/app/views/rails_detail_admin/base/_nav.html.erb +3 -0
  49. data/app/views/rails_detail_admin/items/_form.html.erb +8 -0
  50. data/app/views/rails_detail_admin/items/edit.html.erb +13 -0
  51. data/app/views/rails_detail_admin/items/index.html.erb +50 -0
  52. data/app/views/rails_detail_admin/items/new.html.erb +13 -0
  53. data/app/views/rails_detail_admin/items/show.html.erb +31 -0
  54. data/app/views/rails_detail_admin/lists/_form.html.erb +5 -0
  55. data/app/views/rails_detail_admin/lists/edit.html.erb +12 -0
  56. data/app/views/rails_detail_admin/lists/index.html.erb +36 -0
  57. data/app/views/rails_detail_admin/lists/new.html.erb +16 -0
  58. data/app/views/rails_detail_admin/lists/taxon.html.erb +44 -0
  59. data/app/views/rails_detail_admin/sections/_form.html.erb +22 -0
  60. data/app/views/rails_detail_admin/sections/_select.html.erb +38 -0
  61. data/app/views/rails_detail_admin/sections/_show_section.html.erb +22 -0
  62. data/app/views/rails_detail_admin/sections/edit.html.erb +17 -0
  63. data/app/views/rails_detail_admin/sections/index.html.erb +18 -0
  64. data/app/views/rails_detail_admin/sections/new.html.erb +13 -0
  65. data/app/views/rails_detail_admin/sources/_form.html.erb +8 -0
  66. data/app/views/rails_detail_admin/sources/edit.html.erb +6 -0
  67. data/app/views/rails_detail_admin/sources/index.html.erb +21 -0
  68. data/app/views/rails_detail_admin/sources/new.html.erb +5 -0
  69. data/app/views/rails_detail_admin/sources/show.html.erb +5 -0
  70. data/app/views/rails_detail_admin/wikis/_breadcrumb.html.erb +6 -0
  71. data/app/views/rails_detail_admin/wikis/_nav.html.erb +16 -0
  72. data/app/views/rails_detail_admin/wikis/_nav_index.html.erb +5 -0
  73. data/app/views/rails_detail_admin/wikis/_push.html.erb +10 -0
  74. data/app/views/rails_detail_admin/wikis/_search.html.erb +21 -0
  75. data/app/views/rails_detail_admin/wikis/_section.html.erb +72 -0
  76. data/app/views/rails_detail_admin/wikis/_solo.html.erb +26 -0
  77. data/app/views/rails_detail_admin/wikis/fade_form.js.erb +9 -0
  78. data/app/views/rails_detail_admin/wikis/index.html.erb +24 -0
  79. data/app/views/rails_detail_admin/wikis/show.html.erb +33 -0
  80. data/app/views/rails_detail_my/answers/_answer.html.erb +14 -0
  81. data/app/views/rails_detail_my/answers/_form.html.erb +16 -0
  82. data/app/views/rails_detail_my/answers/edit.html.erb +11 -0
  83. data/app/views/rails_detail_my/answers/index.html.erb +31 -0
  84. data/app/views/rails_detail_my/answers/new.html.erb +22 -0
  85. data/app/views/rails_detail_my/answers/show.html.erb +19 -0
  86. data/app/views/rails_detail_my/details/_form.html.erb +29 -0
  87. data/app/views/rails_detail_my/details/_major.html.erb +21 -0
  88. data/app/views/rails_detail_my/details/_minor.html.erb +25 -0
  89. data/app/views/rails_detail_my/details/_nav.html/347/232/204/345/211/257/346/234/254.erb +14 -0
  90. data/app/views/rails_detail_my/details/edit.html.erb +37 -0
  91. data/app/views/rails_detail_my/details/fade_form.js.erb +9 -0
  92. data/app/views/rails_detail_my/details/index.html.erb +10 -0
  93. data/app/views/rails_detail_my/details/search.json.jbuilder +5 -0
  94. data/app/views/rails_detail_my/details/show.html.erb +52 -0
  95. data/app/views/rails_detail_my/entity_items/_edit.html.erb +15 -0
  96. data/app/views/rails_detail_my/entity_items/_new.html.erb +16 -0
  97. data/app/views/rails_detail_my/entity_items/_taxon_item.html.erb +26 -0
  98. data/app/views/rails_detail_my/entity_items/create.js.erb +23 -0
  99. data/app/views/rails_detail_my/entity_items/destroy.js.erb +26 -0
  100. data/app/views/rails_detail_my/entity_items/edit.js.erb +5 -0
  101. data/app/views/rails_detail_my/entity_items/index.html.erb +40 -0
  102. data/app/views/rails_detail_my/entity_items/new.js.erb +7 -0
  103. data/app/views/rails_detail_my/entity_items/show.html.erb +0 -0
  104. data/app/views/rails_detail_my/entity_items/update.js.erb +1 -0
  105. data/app/views/rails_detail_my/knowledges/_form.html.erb +7 -0
  106. data/app/views/rails_detail_my/knowledges/_sort.html.erb +15 -0
  107. data/app/views/rails_detail_my/knowledges/_td.html.erb +14 -0
  108. data/app/views/rails_detail_my/knowledges/edit.html.erb +12 -0
  109. data/app/views/rails_detail_my/knowledges/index.html.erb +46 -0
  110. data/app/views/rails_detail_my/knowledges/new.html.erb +13 -0
  111. data/app/views/rails_detail_my/knowledges/new_belong.html.erb +36 -0
  112. data/app/views/rails_detail_my/knowledges/show.html.erb +44 -0
  113. data/app/views/rails_detail_my/majors/_form.html.erb +7 -0
  114. data/app/views/rails_detail_my/majors/_new.html.erb +5 -0
  115. data/app/views/rails_detail_my/majors/create.js.erb +4 -0
  116. data/app/views/rails_detail_my/majors/index.html.erb +39 -0
  117. data/app/views/rails_detail_my/majors/index2.html.erb +38 -0
  118. data/app/views/rails_detail_my/majors/new.html.erb +3 -0
  119. data/app/views/rails_detail_my/majors/new.js.erb +1 -0
  120. data/app/views/rails_detail_my/majors/show.html.erb +21 -0
  121. data/app/views/rails_detail_my/minors/_form.html.erb +7 -0
  122. data/app/views/rails_detail_my/minors/_new.html.erb +7 -0
  123. data/app/views/rails_detail_my/minors/_part.html.erb +59 -0
  124. data/app/views/rails_detail_my/minors/create.js.erb +10 -0
  125. data/app/views/rails_detail_my/minors/index.html.erb +41 -0
  126. data/app/views/rails_detail_my/minors/new.html.erb +1 -0
  127. data/app/views/rails_detail_my/minors/new.js.erb +1 -0
  128. data/app/views/rails_detail_my/minors/show.html.erb +22 -0
  129. data/app/views/rails_detail_my/notes/_add_link.html.erb +6 -0
  130. data/app/views/rails_detail_my/notes/_form.html.erb +4 -0
  131. data/app/views/rails_detail_my/notes/_new.html.erb +2 -0
  132. data/app/views/rails_detail_my/notes/_note.html.erb +16 -0
  133. data/app/views/rails_detail_my/notes/_show.html.erb +9 -0
  134. data/app/views/rails_detail_my/notes/create.js.erb +2 -0
  135. data/app/views/rails_detail_my/notes/edit.js.erb +1 -0
  136. data/app/views/rails_detail_my/notes/new.html.erb +2 -0
  137. data/app/views/rails_detail_my/notes/new.js.erb +24 -0
  138. data/app/views/rails_detail_my/notes/show.html.erb +2 -0
  139. data/app/views/rails_detail_my/notes/update.js.erb +1 -0
  140. data/app/views/rails_detail_my/parts/_new.html.erb +7 -0
  141. data/app/views/rails_detail_my/parts/_part.html.erb +59 -0
  142. data/app/views/rails_detail_my/parts/create.js.erb +10 -0
  143. data/app/views/rails_detail_my/parts/index.html.erb +39 -0
  144. data/app/views/rails_detail_my/parts/new.html.erb +1 -0
  145. data/app/views/rails_detail_my/parts/new.js.erb +1 -0
  146. data/app/views/rails_detail_my/parts/show.html.erb +22 -0
  147. data/app/views/rails_detail_my/pictures/_add_link.html.erb +6 -0
  148. data/app/views/rails_detail_my/pictures/_edit.html.erb +8 -0
  149. data/app/views/rails_detail_my/pictures/_index.html.erb +9 -0
  150. data/app/views/rails_detail_my/pictures/_new.html.erb +12 -0
  151. data/app/views/rails_detail_my/pictures/_search_form.html.erb +7 -0
  152. data/app/views/rails_detail_my/pictures/_show.html.erb +17 -0
  153. data/app/views/rails_detail_my/pictures/create.js.erb +2 -0
  154. data/app/views/rails_detail_my/pictures/destroy.js.erb +1 -0
  155. data/app/views/rails_detail_my/pictures/edit.js.erb +2 -0
  156. data/app/views/rails_detail_my/pictures/index.html.erb +2 -0
  157. data/app/views/rails_detail_my/pictures/new.html.erb +2 -0
  158. data/app/views/rails_detail_my/pictures/new.js.erb +1 -0
  159. data/app/views/rails_detail_my/pictures/show.html.erb +10 -0
  160. data/app/views/rails_detail_my/pictures/update.js.erb +1 -0
  161. data/app/views/rails_detail_my/sections/_form.html.erb +22 -0
  162. data/app/views/rails_detail_my/sections/_select.html.erb +38 -0
  163. data/app/views/rails_detail_my/sections/_show_section.html.erb +22 -0
  164. data/app/views/rails_detail_my/sections/edit.html.erb +17 -0
  165. data/app/views/rails_detail_my/sections/index.html.erb +18 -0
  166. data/app/views/rails_detail_my/sections/new.html.erb +13 -0
  167. data/app/views/rails_detail_my/solos/_new.html.erb +5 -0
  168. data/app/views/rails_detail_my/solos/create.js.erb +4 -0
  169. data/app/views/rails_detail_my/solos/edit.js.erb +1 -0
  170. data/app/views/rails_detail_my/solos/index.html.erb +38 -0
  171. data/app/views/rails_detail_my/solos/new.html.erb +3 -0
  172. data/app/views/rails_detail_my/solos/show.html.erb +21 -0
  173. data/app/views/rails_detail_my/sorts/_form.html.erb +29 -0
  174. data/app/views/rails_detail_my/sorts/_head.html.erb +24 -0
  175. data/app/views/rails_detail_my/sorts/_sort.html.erb +49 -0
  176. data/app/views/rails_detail_my/sorts/_sub.html.erb +16 -0
  177. data/app/views/rails_detail_my/sorts/edit.html.erb +14 -0
  178. data/app/views/rails_detail_my/sorts/edit_father.html.erb +17 -0
  179. data/app/views/rails_detail_my/sorts/pic.html.erb +46 -0
  180. data/app/views/rails_detail_my/sorts/search.json.jbuilder +6 -0
  181. data/app/views/rails_detail_my/sorts/show.html.erb +17 -0
  182. data/app/views/rails_detail_my/sorts/sub.js.erb +5 -0
  183. data/app/views/rails_detail_my/sources/_form.html.erb +8 -0
  184. data/app/views/rails_detail_my/sources/edit.html.erb +6 -0
  185. data/app/views/rails_detail_my/sources/index.html.erb +21 -0
  186. data/app/views/rails_detail_my/sources/new.html.erb +5 -0
  187. data/app/views/rails_detail_my/sources/show.html.erb +5 -0
  188. data/app/views/rails_detail_my/taxon_items/_form.html.erb +4 -0
  189. data/app/views/rails_detail_my/taxon_items/_new.html.erb +13 -0
  190. data/app/views/rails_detail_my/taxon_items/_new_list.html.erb +13 -0
  191. data/app/views/rails_detail_my/taxon_items/_taxon_item.html.erb +5 -0
  192. data/app/views/rails_detail_my/taxon_items/create.js.erb +1 -0
  193. data/app/views/rails_detail_my/taxon_items/destroy.js.erb +1 -0
  194. data/app/views/rails_detail_my/taxon_items/edit.html.erb +14 -0
  195. data/app/views/rails_detail_my/taxon_items/edit.js.erb +5 -0
  196. data/app/views/rails_detail_my/taxon_items/index.html.erb +40 -0
  197. data/app/views/rails_detail_my/taxon_items/new.html.erb +9 -0
  198. data/app/views/rails_detail_my/taxon_items/new.js.erb +28 -0
  199. data/app/views/rails_detail_my/taxon_items/update.js.erb +1 -0
  200. data/app/views/rails_detail_my/wikis/_head.html.erb +24 -0
  201. data/app/views/rails_detail_my/wikis/_head.html/347/232/204/345/211/257/346/234/254.erb +34 -0
  202. data/app/views/rails_detail_my/wikis/_sub.html.erb +16 -0
  203. data/app/views/rails_detail_my/wikis/create.js.erb +3 -0
  204. data/app/views/rails_detail_my/wikis/edit.html.erb +14 -0
  205. data/app/views/rails_detail_my/wikis/edit.html/347/232/204/345/211/257/346/234/254.erb +14 -0
  206. data/app/views/rails_detail_my/wikis/edit_father.html.erb +17 -0
  207. data/app/views/rails_detail_my/wikis/index.html.erb +41 -0
  208. data/app/views/rails_detail_my/wikis/new.js.erb +3 -0
  209. data/app/views/rails_detail_my/wikis/pic.html.erb +46 -0
  210. data/app/views/rails_detail_my/wikis/search.json.jbuilder +6 -0
  211. data/app/views/rails_detail_my/wikis/show.html.erb +17 -0
  212. data/app/views/rails_detail_my/wikis/show.html/347/232/204/345/211/257/346/234/254.erb +25 -0
  213. data/app/views/rails_detail_my/wikis/sub.js.erb +5 -0
  214. data/app/views/wikis/_form.html.erb +29 -0
  215. data/app/views/wikis/_head.html.erb +34 -0
  216. data/app/views/wikis/_nav.html.erb +2 -0
  217. data/app/views/wikis/_sort.html.erb +15 -0
  218. data/app/views/wikis/edit.html.erb +14 -0
  219. data/app/views/wikis/index.html.erb +20 -0
  220. data/app/views/wikis/new.html.erb +11 -0
  221. data/app/views/wikis/show.html.erb +25 -0
  222. data/config/locales/zh.yml +10 -0
  223. data/config/routes.rb +31 -0
  224. data/db/20171115144429_create_lists.rb +39 -0
  225. data/db/migrate/20150723122558_create_knowledge.rb +16 -0
  226. data/db/migrate_backup/20150801141208_add_parent_id_to_knowledge.rb +23 -0
  227. data/db/migrate_backup/20150801154145_add_column_to_wikis.rb +8 -0
  228. data/db/migrate_backup/20150801154531_add_position_to_knowledges.rb +6 -0
  229. data/db/migrate_backup/20150801163012_add_wiki_histories_to_wiki.rb +5 -0
  230. data/db/migrate_backup/20150802015359_change_wiki_histories_count.rb +5 -0
  231. data/db/migrate_backup/20150802134532_add_active_to_wikis.rb +6 -0
  232. data/db/migrate_backup/20150802154605_add_type_to_wiki_histroy.rb +8 -0
  233. data/db/migrate_backup/20150802161426_add_major_records_count_to_know.rb +6 -0
  234. data/db/migrate_backup/20150905144632_create_konwledage_items.rb +21 -0
  235. data/db/migrate_backup/20150907124021_remove_photo_id_from_items.rb +8 -0
  236. data/db/migrate_backup/20150919025025_rename_wiki_to_content.rb +7 -0
  237. data/db/migrate_backup/20151214033632_create_parts.rb +12 -0
  238. data/db/migrate_backup/schema.rb +186 -0
  239. data/lib/rails_detail.rb +26 -0
  240. data/lib/rails_detail/config.rb +19 -0
  241. data/lib/rails_detail/engine.rb +28 -0
  242. data/lib/rails_detail/version.rb +3 -0
  243. data/lib/tasks/the_detail_tasks.rake +4 -0
  244. data/test/controllers/knowledges_controller_test.rb +49 -0
  245. data/test/controllers/the_detail/pictures_controller_test.rb +48 -0
  246. data/test/integration/navigation_test.rb +10 -0
  247. data/test/system/the_detail/pictures_test.rb +41 -0
  248. data/test/test_helper.rb +18 -0
  249. data/test/the_detail_test.rb +7 -0
  250. metadata +346 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e2ecaa01737fbc40fa4fc6c0d3b68b3ad846bcdcead9d9b0ad13d528642b955e
4
+ data.tar.gz: e41c4f86e761bcaae83189277d682a042672b5057aec1c6b781ac5b014d4cf3f
5
+ SHA512:
6
+ metadata.gz: 9b8a901c81aa87c4c2a07eeebc0e6d1022b4407bc21c7ca9946472dee850d3e01ac233ceba908a450fc537695b2a25710a2a3dc31d3e741a1150d71cef7f9ece
7
+ data.tar.gz: e1d2ba516ef0ee82051714759ea1cc277db2071dbd8a9b7d3bf4d3f578c3193c241e2e046f056014d5928b729870f799b93d0b33e2b28f1f4caea92666fb9b8a
data/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2018 Mingyuan Qin.
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ = RailsDetail
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'RailsDetail'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
@@ -0,0 +1,3 @@
1
+ //= link rails_detail/application.css
2
+ //= link rails_detail/application.js
3
+ //= link_tree ../javascripts/controllers .js
@@ -0,0 +1 @@
1
+ //= require input-attachment
@@ -0,0 +1,45 @@
1
+ $('.ui.slider.checkbox').checkbox({
2
+ onChecked: function(){
3
+ var url = this.dataset['url'];
4
+ var params = {
5
+ method: 'POST',
6
+ credentials: 'include',
7
+ headers: {
8
+ 'Content-Type': 'application/json',
9
+ 'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
10
+ },
11
+ body: JSON.stringify({
12
+ taxon_item_id: this.value
13
+ })
14
+ };
15
+ fetch(url, params).then(function(response) {
16
+ return response.text()
17
+ }).then(function(response) {
18
+ var script = document.createElement('script');
19
+ script.text = response;
20
+ document.head.appendChild(script).parentNode.removeChild(script);
21
+ }).catch(function(ex) {
22
+ console.log('parsing failed', ex)
23
+ })
24
+ },
25
+ onUnchecked: function(){
26
+ var url = this.dataset['url'];
27
+ var params = {
28
+ method: 'DELETE',
29
+ credentials: 'include',
30
+ headers: {
31
+ 'Content-Type': 'application/javascript',
32
+ 'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
33
+ }
34
+ };
35
+ fetch(url, params).then(function(response) {
36
+ return response.text()
37
+ }).then(function(response) {
38
+ var script = document.createElement('script');
39
+ script.text = response;
40
+ document.head.appendChild(script).parentNode.removeChild(script);
41
+ }).catch(function(ex) {
42
+ console.log('parsing failed', ex)
43
+ })
44
+ }
45
+ });
@@ -0,0 +1,18 @@
1
+ //= require input-attachment
2
+
3
+ class HelloController extends Stimulus.Controller {
4
+ greet() {
5
+ console.log("Hellos, Stimulus!", this.element)
6
+ }
7
+
8
+ connect() {
9
+ console.log("Connects, Stimulus!", this.element)
10
+ var self = this;
11
+ attachToPreview({
12
+ fileInput: 'picture_file'
13
+ });
14
+ }
15
+ }
16
+ HelloController.targets = ['src']
17
+ const application = Stimulus.Application.start()
18
+ application.register('attachment', HelloController)
@@ -0,0 +1,47 @@
1
+
2
+ $.fn.search.settings.templates.knowledge = function(response) {
3
+ var html = '';
4
+
5
+ if(response.results !== undefined) {
6
+
7
+ // each result
8
+ $.each(response.results, function(index, result) {
9
+ if(result.url) {
10
+ html += '<a class="result" href="' + result.url + '">';
11
+ }
12
+ else {
13
+ html += '<a class="result">';
14
+ }
15
+ if(result.image !== undefined) {
16
+ html += ''
17
+ + '<div class="image">'
18
+ + ' <img src="' + result.image + '">'
19
+ + '</div>'
20
+ ;
21
+ }
22
+ html += '<div class="content">';
23
+ if(result.price !== undefined) {
24
+ html += '<div class="price">' + result.price + '</div>';
25
+ }
26
+ if(result.title !== undefined) {
27
+ html += '<div class="title">' + result.title + '</div>';
28
+ }
29
+ if(result.description !== undefined) {
30
+ html += '<div class="description">' + result.description + '</div>';
31
+ }
32
+ html += ''
33
+ + '</div>'
34
+ ;
35
+ html += '</a>';
36
+ });
37
+
38
+ if(response.action) {
39
+ html += ''
40
+ + '<a href="' + response.action.url + '" class="action">'
41
+ + response.action.text
42
+ + '</a>';
43
+ }
44
+ return html;
45
+ }
46
+ return false;
47
+ };
@@ -0,0 +1,4 @@
1
+ //= require jquery
2
+ //= require rails-ujs
3
+ //= require turbolinks
4
+ //= require_self
@@ -0,0 +1,14 @@
1
+ /*
2
+ *= require_self
3
+ */
4
+
5
+ .ui.form textarea {
6
+ border-radius: 0;
7
+ }
8
+
9
+ .ui.form .attached.segment {
10
+ width: 100%;
11
+ border-top: none;
12
+ }
13
+
14
+
@@ -0,0 +1,5 @@
1
+ class RailsDetailAdmin::BaseController < RailsDetail.config.admin_class.constantize
2
+
3
+
4
+
5
+ end
@@ -0,0 +1,76 @@
1
+ class RailsDetailAdmin::ItemsController < RailsDetailAdmin::BaseController
2
+ before_action :set_list
3
+ before_action :set_item, only: [:show, :edit, :update, :destroy]
4
+
5
+ def index
6
+ @items = @list.items.page(params[:page])
7
+ end
8
+
9
+ def new
10
+ @item = @list.items.build
11
+ end
12
+
13
+ def create
14
+ @item = @list.items.build item_params
15
+
16
+ respond_to do |format|
17
+ if @item.save
18
+ @item.logo.attach(logo_params) if logo_params.present?
19
+ format.html { redirect_to admin_list_items_url(params[:list_id]), :notice => '商品描述创建成功' }
20
+ format.json { render json: @item, status: :created, location: @item }
21
+ else
22
+ format.html { render action: "new" }
23
+ format.json { render json: @item.errors, status: :unprocessable_entity }
24
+ end
25
+ end
26
+ end
27
+
28
+ def show
29
+
30
+ end
31
+
32
+ def edit
33
+ @list = @item.list
34
+ end
35
+
36
+ def update
37
+ @item.logo.attach(logo_params) if logo_params.present?
38
+
39
+ respond_to do |format|
40
+ if @item.update item_params
41
+ format.html { redirect_to admin_list_items_url(@item.list_id), notice: '更新成功' }
42
+ format.json { head :no_content }
43
+ else
44
+ format.html { render action: "edit" }
45
+ format.json { render json: @item.errors, status: :unprocessable_entity }
46
+ end
47
+ end
48
+ end
49
+
50
+ def destroy
51
+ @item.destroy
52
+
53
+ respond_to do |format|
54
+ format.html { redirect_to admin_list_items_url(@item.list_id) }
55
+ format.json { head :no_content }
56
+ end
57
+ end
58
+
59
+ private
60
+ def set_list
61
+ @list = List.find params[:list_id]
62
+ end
63
+
64
+ def set_item
65
+ @item = Item.find params[:id]
66
+ end
67
+
68
+ def item_params
69
+ params[:item].permit(:name, :logo, :desc, :key)
70
+ end
71
+
72
+ def logo_params
73
+ params.fetch(:item, {}).permit(:logo).fetch(:logo, {})
74
+ end
75
+
76
+ end