fassets_core 0.2.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.
Files changed (175) hide show
  1. data/MIT-LICENSE +21 -0
  2. data/README.md +22 -0
  3. data/Rakefile +39 -0
  4. data/app/assets/images/fassets_core/add.png +0 -0
  5. data/app/assets/images/fassets_core/archive.png +0 -0
  6. data/app/assets/images/fassets_core/classify.png +0 -0
  7. data/app/assets/images/fassets_core/clipboard.png +0 -0
  8. data/app/assets/images/fassets_core/collapse.png +0 -0
  9. data/app/assets/images/fassets_core/collapsed.png +0 -0
  10. data/app/assets/images/fassets_core/delete.png +0 -0
  11. data/app/assets/images/fassets_core/drag.png +0 -0
  12. data/app/assets/images/fassets_core/edit.png +0 -0
  13. data/app/assets/images/fassets_core/link.png +0 -0
  14. data/app/assets/images/fassets_core/markup_preview.png +0 -0
  15. data/app/assets/images/fassets_core/remove.png +0 -0
  16. data/app/assets/images/fassets_core/sort.png +0 -0
  17. data/app/assets/images/fassets_core/warning.png +0 -0
  18. data/app/assets/javascripts/fassets_core/add_asset_box.js +102 -0
  19. data/app/assets/javascripts/fassets_core/application.js.erb +14 -0
  20. data/app/assets/javascripts/fassets_core/assets.js +31 -0
  21. data/app/assets/javascripts/fassets_core/catalog_box.js +73 -0
  22. data/app/assets/javascripts/fassets_core/catalogs.js +46 -0
  23. data/app/assets/javascripts/fassets_core/classification.js +37 -0
  24. data/app/assets/javascripts/fassets_core/edit_box.js +63 -0
  25. data/app/assets/javascripts/fassets_core/facets.js.erb +32 -0
  26. data/app/assets/javascripts/fassets_core/tray.js +30 -0
  27. data/app/assets/stylesheets/fassets_core/add_asset_box.css.scss +77 -0
  28. data/app/assets/stylesheets/fassets_core/application.css +16 -0
  29. data/app/assets/stylesheets/fassets_core/assets.css.scss +74 -0
  30. data/app/assets/stylesheets/fassets_core/catalog_box.css.scss +45 -0
  31. data/app/assets/stylesheets/fassets_core/collapsible.css.scss +54 -0
  32. data/app/assets/stylesheets/fassets_core/edit_box.css.scss +58 -0
  33. data/app/assets/stylesheets/fassets_core/facet.css.scss +56 -0
  34. data/app/assets/stylesheets/fassets_core/filter.css.scss +20 -0
  35. data/app/assets/stylesheets/fassets_core/forms.css.scss +12 -0
  36. data/app/assets/stylesheets/fassets_core/labels.css.scss +13 -0
  37. data/app/assets/stylesheets/fassets_core/master.css.scss +127 -0
  38. data/app/assets/stylesheets/fassets_core/sidebar.css.scss +84 -0
  39. data/app/assets/stylesheets/fassets_core/tray.css.scss +106 -0
  40. data/app/controllers/assets_controller.rb +115 -0
  41. data/app/controllers/catalogs_controller.rb +99 -0
  42. data/app/controllers/classifications_controller.rb +56 -0
  43. data/app/controllers/facets_controller.rb +57 -0
  44. data/app/controllers/fassets_core/application_controller.rb +5 -0
  45. data/app/controllers/labels_controller.rb +54 -0
  46. data/app/controllers/tray_positions_controller.rb +81 -0
  47. data/app/helpers/assets_helper.rb +20 -0
  48. data/app/helpers/catalogs_helper.rb +3 -0
  49. data/app/helpers/classifications_helper.rb +8 -0
  50. data/app/helpers/fassets_core/application_helper.rb +48 -0
  51. data/app/helpers/labels_helper.rb +3 -0
  52. data/app/helpers/tray_positions_helper.rb +3 -0
  53. data/app/models/asset.rb +52 -0
  54. data/app/models/catalog.rb +16 -0
  55. data/app/models/classification.rb +8 -0
  56. data/app/models/facet.rb +19 -0
  57. data/app/models/label.rb +11 -0
  58. data/app/models/label_filter.rb +16 -0
  59. data/app/models/labeling.rb +5 -0
  60. data/app/models/tray_position.rb +9 -0
  61. data/app/views/assets/_add_asset_sidebar.html.haml +8 -0
  62. data/app/views/assets/_classification.html.haml +33 -0
  63. data/app/views/assets/_form.html.haml +30 -0
  64. data/app/views/assets/_put_on_tray.html.haml +7 -0
  65. data/app/views/assets/edit.html.haml +15 -0
  66. data/app/views/assets/new.html.haml +25 -0
  67. data/app/views/assets/show.html.haml +13 -0
  68. data/app/views/catalogs/_box_catalog_list.html.haml +6 -0
  69. data/app/views/catalogs/_box_content.html.haml +13 -0
  70. data/app/views/catalogs/_catalog.html.haml +2 -0
  71. data/app/views/catalogs/_facet.html.haml +13 -0
  72. data/app/views/catalogs/_filter_item.html.haml +3 -0
  73. data/app/views/catalogs/_form.html.haml +6 -0
  74. data/app/views/catalogs/box.html.haml +6 -0
  75. data/app/views/catalogs/edit.html.haml +8 -0
  76. data/app/views/catalogs/index.html.haml +17 -0
  77. data/app/views/catalogs/new.html.haml +8 -0
  78. data/app/views/catalogs/show.html.haml +30 -0
  79. data/app/views/classifications/update.js.erb +4 -0
  80. data/app/views/facets/_form.html.haml +9 -0
  81. data/app/views/facets/edit.html.haml +15 -0
  82. data/app/views/labels/_form.haml +3 -0
  83. data/app/views/labels/_sidebar.html.haml +22 -0
  84. data/app/views/labels/destroy.js.erb +13 -0
  85. data/app/views/layouts/fassets_core/application.html.haml +16 -0
  86. data/app/views/shared/_asset.html.haml +22 -0
  87. data/app/views/shared/_asset_form.html.haml +7 -0
  88. data/app/views/shared/_classification.html.haml +23 -0
  89. data/app/views/shared/_clipboard.html.haml +10 -0
  90. data/app/views/shared/_error.html.haml +6 -0
  91. data/app/views/shared/_tray.html.haml +13 -0
  92. data/app/views/shared/_tray_position.html.haml +8 -0
  93. data/app/views/tray_positions/create.js.rjs +10 -0
  94. data/app/views/tray_positions/destroy.js.rjs +1 -0
  95. data/app/views/tray_positions/sort.js.rjs +15 -0
  96. data/config/initializers/mime_types.rb +2 -0
  97. data/config/initializers/uploader.rb +2 -0
  98. data/config/initializers/users.rb +7 -0
  99. data/config/routes.rb +34 -0
  100. data/db/migrate/001_create_catalogs.rb +13 -0
  101. data/db/migrate/002_create_facets.rb +14 -0
  102. data/db/migrate/003_create_labels.rb +12 -0
  103. data/db/migrate/005_create_classifications.rb +12 -0
  104. data/db/migrate/006_create_labelings.rb +12 -0
  105. data/db/migrate/007_create_tray_positions.rb +13 -0
  106. data/db/migrate/008_create_assets.rb +16 -0
  107. data/db/migrate/010_add_label_ordering.rb +10 -0
  108. data/db/migrate/017_add_clipboard.rb +11 -0
  109. data/db/migrate/20120803150826_add_position_to_facet.rb +5 -0
  110. data/db/schema.rb +141 -0
  111. data/db/seeds.rb +7 -0
  112. data/lib/acts_as_asset.rb +36 -0
  113. data/lib/authenticated_system.rb +187 -0
  114. data/lib/authenticated_test_helper.rb +20 -0
  115. data/lib/fassets_core.rb +6 -0
  116. data/lib/fassets_core/engine.rb +7 -0
  117. data/lib/fassets_core/plugins.rb +13 -0
  118. data/lib/fassets_core/test_helper.rb +3 -0
  119. data/lib/fassets_core/test_helper/every_assets_controller.rb +161 -0
  120. data/lib/fassets_core/test_helper/every_authenticated_controller.rb +10 -0
  121. data/lib/fassets_core/version.rb +3 -0
  122. data/lib/tasks/cucumber.rake +57 -0
  123. data/lib/tasks/fassets-core_tasks.rake +4 -0
  124. data/lib/template_manager.rb +27 -0
  125. data/test/fassets-core_test.rb +7 -0
  126. data/test/fixtures/asset_contents.yml +7 -0
  127. data/test/fixtures/assets.yml +7 -0
  128. data/test/fixtures/catalogs.yml +9 -0
  129. data/test/fixtures/classifications.yml +7 -0
  130. data/test/fixtures/facets.yml +9 -0
  131. data/test/fixtures/frames.yml +11 -0
  132. data/test/fixtures/image_assets.yml +7 -0
  133. data/test/fixtures/labellings.yml +7 -0
  134. data/test/fixtures/labels.yml +9 -0
  135. data/test/fixtures/presentations.yml +7 -0
  136. data/test/fixtures/slides.yml +11 -0
  137. data/test/fixtures/slots.yml +0 -0
  138. data/test/fixtures/topics.yml +11 -0
  139. data/test/fixtures/tray_positions.yml +7 -0
  140. data/test/fixtures/users.yml +31 -0
  141. data/test/functional/assets_controller_test.rb +8 -0
  142. data/test/functional/catalogs_controller_test.rb +8 -0
  143. data/test/functional/classifications_controller_test.rb +8 -0
  144. data/test/functional/content_controller_test.rb +8 -0
  145. data/test/functional/facets_controller_test.rb +8 -0
  146. data/test/functional/file_assets_controller_test.rb +8 -0
  147. data/test/functional/files_controller_test.rb +8 -0
  148. data/test/functional/labellings_controller_test.rb +8 -0
  149. data/test/functional/labels_controller_test.rb +8 -0
  150. data/test/functional/presentations_controller_test.rb +8 -0
  151. data/test/functional/sessions_controller_test.rb +82 -0
  152. data/test/functional/slides_controller_test.rb +8 -0
  153. data/test/functional/slots_controller_test.rb +8 -0
  154. data/test/functional/tray_positions_controller_test.rb +8 -0
  155. data/test/functional/urls_controller_test.rb +8 -0
  156. data/test/functional/users_controller_test.rb +58 -0
  157. data/test/integration/navigation_test.rb +10 -0
  158. data/test/performance/browsing_test.rb +9 -0
  159. data/test/test_helper.rb +10 -0
  160. data/test/unit/asset_content_test.rb +8 -0
  161. data/test/unit/asset_test.rb +8 -0
  162. data/test/unit/catalog_test.rb +8 -0
  163. data/test/unit/classification_test.rb +8 -0
  164. data/test/unit/facet_test.rb +8 -0
  165. data/test/unit/frame_test.rb +8 -0
  166. data/test/unit/image_asset_test.rb +8 -0
  167. data/test/unit/label_test.rb +8 -0
  168. data/test/unit/labelling_test.rb +8 -0
  169. data/test/unit/presentation_test.rb +8 -0
  170. data/test/unit/slide_test.rb +8 -0
  171. data/test/unit/slot_test.rb +8 -0
  172. data/test/unit/topic_test.rb +8 -0
  173. data/test/unit/tray_position_test.rb +8 -0
  174. data/test/unit/user_test.rb +103 -0
  175. metadata +453 -0
@@ -0,0 +1,99 @@
1
+ class CatalogsController < FassetsCore::ApplicationController
2
+ before_filter :authenticate_user!, :except => [:index, :show]
3
+
4
+ before_filter :find_catalog, :except => [:index, :new, :create, :add_asset, :catalog_box]
5
+ def index
6
+ @catalogs = Catalog.all
7
+ end
8
+ def show
9
+ @filter = LabelFilter.new(params[:filter])
10
+ @assets = @catalog.assets.filter(@filter)
11
+ @counts = 0
12
+ logger.debug "Flash:"+flash.to_s
13
+ end
14
+ def new
15
+ @catalog = Catalog.new
16
+ end
17
+ def create
18
+ @catalog = Catalog.new(params[:catalog])
19
+ if @catalog.save
20
+ create_type_facet()
21
+ flash[:notice] = "Catalog was successfully created."
22
+ redirect_to catalogs_path
23
+ else
24
+ if params[:catalog][:title].blank?
25
+ flash[:error] = "Catalog could not be created! Title cannot be empty!"
26
+ else
27
+ flash[:error] = "Catalog could not be created!"
28
+ end
29
+ render :template => 'catalogs/index'
30
+ end
31
+ end
32
+ def edit
33
+ @catalog = Catalog.find(params[:id])
34
+ end
35
+ def update
36
+ if params[:catalog][:title].blank?
37
+ flash[:error] = "Catalog could not be updated! Title cannot be empty!"
38
+ redirect_to :back
39
+ return
40
+ end
41
+ if @catalog.update_attributes(params[:catalog])
42
+ redirect_to catalog_path(@catalog)
43
+ else
44
+ render :action => 'edit'
45
+ end
46
+ end
47
+ def destroy
48
+ @catalog.destroy
49
+ flash[:notice] = "Catalog was successfully destroyed."
50
+ redirect_to root_url
51
+ end
52
+ def add_asset
53
+ @catalog = Catalog.find(params[:catalog_id])
54
+ if Classification.where(:catalog_id => params[:catalog_id], :asset_id => params[:asset_id]).exists?
55
+ flash[:error] = "Asset already in catalog!"
56
+ redirect_to :back
57
+ return
58
+ end
59
+ classification = Classification.new(:catalog_id => params[:catalog_id], :asset_id => params[:asset_id]);
60
+ if classification.save
61
+ flash[:notice] = "Asset successfully added to catalog"
62
+ else
63
+ flash[:error] = "Could not add asset to catalog"
64
+ end
65
+ redirect_to catalog_path(@catalog)
66
+ end
67
+ def catalog_box
68
+ if params[:id]
69
+ @catalog = Catalog.find(params[:id])
70
+ else
71
+ @catalog = Catalog.first
72
+ end
73
+ @filter = LabelFilter.new(params[:filter])
74
+ @assets = @catalog.assets.filter(@filter)
75
+ @counts = 0
76
+ render :template => "catalogs/box", :layout => false, :locals => {:selected_catalog => @catalog.id}
77
+ end
78
+ def box_content
79
+ @filter = LabelFilter.new(params[:filter])
80
+ @assets = @catalog.assets.filter(@filter)
81
+ @counts = 0
82
+ render :partial => "box_content"
83
+ end
84
+ def box_facet
85
+ @filter = LabelFilter.new(params[:filter])
86
+ @counts = 0
87
+ render :partial => "box_facet", :collection => @catalog.facets, :as => :facet
88
+ end
89
+ protected
90
+ def create_type_facet
91
+ facet = Facet.new(:caption => "Content Type", :color => "orange", :label_order => "value ASC, caption ASC")
92
+ facet.catalog_id = @catalog.id
93
+ facet.save
94
+ end
95
+ def find_catalog
96
+ @catalog = Catalog.find(params[:id])
97
+ end
98
+ end
99
+
@@ -0,0 +1,56 @@
1
+ class ClassificationsController < FassetsCore::ApplicationController
2
+ before_filter :authenticate_user!
3
+ before_filter :find_classification, :only => [:update, :destroy]
4
+
5
+ respond_to :html, :js
6
+
7
+ def create
8
+ if params[:asset_id]
9
+ @classification = Classification.new(:asset_id => params[:asset_id],:catalog_id => params[:catalog_id])
10
+ @classification.save
11
+ create_content_labeling(params[:asset_id],params[:catalog_id])
12
+ else
13
+ classification = Classification.new(params[:classification])
14
+ classification.save
15
+ end
16
+ render :nothing => true
17
+ end
18
+ def destroy
19
+ @classification.destroy
20
+ render :nothing => true
21
+ end
22
+ def update
23
+ if params[:commit] == "Drop"
24
+ @classification.destroy()
25
+ return
26
+ end
27
+ @classification.label_ids = params[:labels]
28
+ flash[:notice] = "Updated Classification"
29
+ respond_with do |format|
30
+ format.js
31
+ format.html {}
32
+ end
33
+ end
34
+
35
+ protected
36
+ def create_content_labeling(asset_id,catalog_id)
37
+ asset = Asset.find(asset_id)
38
+ content_facet = Facet.where(:catalog_id => catalog_id, :caption => "Content Type").first
39
+ unless content_facet
40
+ content_facet = Facet.create(:caption => "Content Type", :color => "orange", :label_order => "value ASC, caption ASC", :catalog_id => catalog_id)
41
+ end
42
+ media_type = asset.content.media_type.capitalize
43
+ label = Label.where(:facet_id => content_facet.id, :caption => media_type.to_s).first
44
+ unless label
45
+ label = Label.new(:facet_id => content_facet.id, :caption => media_type.to_s)
46
+ label.save
47
+ end
48
+ labeling = Labeling.new(:classification_id => @classification.id, :label_id => label.id)
49
+ labeling.save
50
+ end
51
+
52
+ def find_classification
53
+ @classification = Classification.find(params[:id])
54
+ end
55
+ end
56
+
@@ -0,0 +1,57 @@
1
+ class FacetsController < FassetsCore::ApplicationController
2
+ before_filter :authenticate_user!
3
+ before_filter :find_catalog
4
+
5
+ def new
6
+ end
7
+ def create
8
+ @facet = Facet.new(params[:facet])
9
+ @facet.catalog_id = @catalog.id
10
+ if @facet.save
11
+ flash[:notice] = "Facet was successfully created."
12
+ redirect_to edit_catalog_facet_path(@catalog, @facet)
13
+ else
14
+ if params[:facet][:caption].blank?
15
+ flash[:error] = "Facet could not be created! Caption cannot be empty!"
16
+ else
17
+ flash[:error] = "Facet could not be created!"
18
+ end
19
+ redirect_to :back
20
+ end
21
+ end
22
+ def edit
23
+ @facet = @catalog.facets.find(params[:id])
24
+ end
25
+ def update
26
+ if params[:facet][:caption].blank?
27
+ flash[:error] = "Facet could not be updated! Caption cannot be empty"
28
+ redirect_to :back
29
+ return
30
+ end
31
+ @facet = @catalog.facets.find(params[:id])
32
+ if @facet.update_attributes(params[:facet])
33
+ flash[:notice] = "Facet has been updated."
34
+ redirect_to edit_catalog_facet_path(@catalog, @facet)
35
+ else
36
+ render :action => 'edit'
37
+ end
38
+ end
39
+ def destroy
40
+ @catalog = @catalog.facets.find(params[:id])
41
+ @catalog.destroy
42
+ flash[:notice] = "Facet was successfully destroyed."
43
+ redirect_to catalog_path(@catalog)
44
+ end
45
+ def sort
46
+ @facetsInScope = Facet.where("catalog_id = ?", @catalog.id)
47
+ params[:facet].each_with_index do |id, index|
48
+ @facetsInScope.update(id, :position => index)
49
+ end
50
+ render :nothing => true
51
+ end
52
+ protected
53
+ def find_catalog
54
+ @catalog = Catalog.find(params[:catalog_id])
55
+ end
56
+ end
57
+
@@ -0,0 +1,5 @@
1
+ module FassetsCore
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
5
+
@@ -0,0 +1,54 @@
1
+ class LabelsController < FassetsCore::ApplicationController
2
+ before_filter :authenticate_user!
3
+ before_filter :find_label, :except => [:create, :sort]
4
+ def create
5
+ @label = Label.new(params[:label])
6
+ @label.facet_id = params[:facet_id]
7
+ if @label.save
8
+ flash[:notice] = "Label was successfully created."
9
+ redirect_to edit_catalog_facet_path(params[:catalog_id], params[:facet_id])
10
+ else
11
+ if params[:label][:caption].blank?
12
+ flash[:error] = "Label could not be created! Caption cannot be empty!"
13
+ else
14
+ flash[:error] = "Label could not be created!"
15
+ end
16
+ redirect_to :back
17
+ end
18
+ end
19
+ def update
20
+ if params[:label][:caption].blank?
21
+ flash[:error] = "Label could not be updated! Caption cannot be empty!"
22
+ redirect_to :back
23
+ return
24
+ end
25
+ @label.update_attributes(params[:label])
26
+ flash[:notice] = "Label was successfully updated."
27
+ redirect_to edit_catalog_facet_path(params[:catalog_id], params[:facet_id])
28
+ end
29
+ def sort
30
+ params[:label].each_with_index do |id, position|
31
+ Label.update(id, :position => position+1)
32
+ end
33
+ respond_to do |format|
34
+ format.js {render :nothing => true}
35
+ end
36
+ end
37
+ def destroy
38
+ @label.destroy
39
+ @facet = @label.facet
40
+ @catalog = @facet.catalog
41
+ @label = nil
42
+
43
+ flash[:notice] = "Label removed."
44
+ respond_to do |format|
45
+ format.js { }
46
+ format.html { redirect_to :back }
47
+ end
48
+ end
49
+ protected
50
+ def find_label
51
+ @label = Label.find(params[:id])
52
+ end
53
+ end
54
+
@@ -0,0 +1,81 @@
1
+ class TrayPositionsController < FassetsCore::ApplicationController
2
+ before_filter :authenticate_user!
3
+ def create
4
+ if current_user.tray_positions.maximum(:position)
5
+ params[:tray_position][:position] = current_user.tray_positions.maximum(:position)+1
6
+ else
7
+ params[:tray_position][:position] = 1
8
+ end
9
+ tp = TrayPosition.new(params[:tray_position])
10
+ tp.clipboard_type.capitalize! if tp.clipboard_type
11
+ tp.save
12
+ render :nothing => true
13
+ #redirect_to :back
14
+ end
15
+ def index
16
+ render :partial => "shared/tray"
17
+ end
18
+ def destroy
19
+ tp = TrayPosition.find(params[:id])
20
+ tp.destroy()
21
+ render :nothing => true
22
+ #redirect_to :back
23
+ end
24
+ def replace
25
+ respond_to do |format|
26
+ if params[:del]
27
+ format.html do
28
+ current_user.tray_positions.find(params[:del]).each do |tp|
29
+ # if !tp.clipboard_type && (tp.asset.classifications_count || 0) == 0
30
+ # tp.asset.content.destroy
31
+ # else
32
+ # tp.destroy
33
+ # end
34
+ tp.destroy
35
+ end
36
+ flash[:notice] = "Tray has been updated!"
37
+ redirect_to :back
38
+ end
39
+ end
40
+ if params[:tp]
41
+ format.json do
42
+ new_tp = nil
43
+ params[:tp].each_with_index do |id, position|
44
+ if id == "0"
45
+ new_tp = TrayPosition.new(:user_id => current_user.id, :position => position+1)
46
+ if params[:add_type] == 'asset'
47
+ new_tp.asset_id = params[:add_id]
48
+ else
49
+ new_tp.clipboard_id = params[:add_id]
50
+ new_tp.clipboard_type = params[:add_type].capitalize
51
+ end
52
+ new_tp.save
53
+ else
54
+ TrayPosition.update(id, :position => position+1)
55
+ end
56
+ end
57
+ if new_tp
58
+ render :json => new_tp.to_json(:include => :clipboard)
59
+ else
60
+ render :json => {}
61
+ end
62
+ end
63
+ end
64
+ if params["asset_id"] and params["asset_id"] != "undefined"
65
+ unless TrayPosition.where(:user_id => current_user.id, :asset_id => params["asset_id"]).exists?
66
+ if current_user.tray_positions.maximum(:position)
67
+ position = current_user.tray_positions.maximum(:position)+1
68
+ else
69
+ position = 1
70
+ end
71
+ new_tp = TrayPosition.new(:user_id => current_user.id, :asset_id => params["asset_id"],:position => position)
72
+ new_tp.save
73
+ end
74
+ end
75
+ format.html do
76
+ #redirect_to :back
77
+ end
78
+ end
79
+ end
80
+ end
81
+
@@ -0,0 +1,20 @@
1
+ module AssetsHelper
2
+ def content_partial(content, partial)
3
+ content.class.to_s.underscore.pluralize + "/" + content.media_type.to_s.underscore + "_" + partial.to_s
4
+ end
5
+
6
+ # construct the path for the assets content
7
+ def asset_content_path(content)
8
+ begin
9
+ return url_for content
10
+ rescue NoMethodError
11
+ # it’s fine, if this fails this means, the engine should know about the url
12
+ end
13
+ engine = content.class.to_s.split("::").first + "::Engine"
14
+ send(engine.constantize.engine_name).url_for content
15
+ end
16
+ def edit_asset_content_path(content)
17
+ asset_content_path(content) + "/edit"
18
+ end
19
+ end
20
+
@@ -0,0 +1,3 @@
1
+ module CatalogsHelper
2
+ end
3
+
@@ -0,0 +1,8 @@
1
+ module ClassificationsHelper
2
+ def label_select(facet, label_id)
3
+ options = content_tag(:option, "")
4
+ options << options_from_collection_for_select(facet.labels, :id, :caption, label_id)
5
+ select_tag "classification[label_ids][]", options
6
+ end
7
+ end
8
+
@@ -0,0 +1,48 @@
1
+ module FassetsCore
2
+ module ApplicationHelper
3
+ def tree_ol(acts_as_tree_set, init=true, &block)
4
+ if acts_as_tree_set.size > 0
5
+ if init
6
+ ret = '<ol class="sortable_frames">'
7
+ else
8
+ ret = '<ol>'
9
+ end
10
+ acts_as_tree_set.collect do |item|
11
+ #next if item.parent_id && init
12
+ ret += '<li id="frame_'+item.id.to_s+'" class="frame"><div>'
13
+ ret += yield item
14
+ ret += '</div>'
15
+ ret += tree_ol(item.children, false, &block) if item.children.size > 0
16
+ ret += '</li>'
17
+ end
18
+ ret += '</ol>'
19
+ end
20
+ unless ret == nil
21
+ ret.html_safe
22
+ end
23
+ end
24
+ def menutree_ol(acts_as_tree_set, init=true, &block)
25
+ if acts_as_tree_set.size > 0
26
+ if init
27
+ ret = '<ol class="frame_menu">'
28
+ else
29
+ ret = '<ol>'
30
+ end
31
+ number = 1
32
+ acts_as_tree_set.collect do |item|
33
+ #next if item.parent_id && init
34
+ ret += '<li id="'+item.position.to_s+'">'
35
+ ret += yield item
36
+ ret += menutree_ol(item.children, false, &block) if item.children.size > 0
37
+ ret += '</li>'
38
+ number += 1
39
+ end
40
+ ret += '</ol>'
41
+ end
42
+ unless ret == nil
43
+ ret.html_safe
44
+ end
45
+ end
46
+ end
47
+ end
48
+