fassets_core 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
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,3 @@
1
+ module LabelsHelper
2
+ end
3
+
@@ -0,0 +1,3 @@
1
+ module TrayPositionsHelper
2
+ end
3
+
@@ -0,0 +1,52 @@
1
+ class Asset < ActiveRecord::Base
2
+ belongs_to :user
3
+ belongs_to :content, :polymorphic => true
4
+ has_many :classifications, :dependent => :destroy
5
+ has_many :labelings, :through => :classifications
6
+ has_many :tray_positions, :dependent => :destroy
7
+
8
+ validates_associated :content
9
+ validates_presence_of :name,:content_type
10
+
11
+ after_create :put_on_tray
12
+
13
+ def publish=(test)
14
+ end
15
+ def published=(test)
16
+ end
17
+ def published
18
+ 1
19
+ end
20
+ def self.filter(filter)
21
+ options = {:select => "assets.*", :order => "name"}
22
+ unless filter.empty?
23
+ options[:joins] = "LEFT OUTER JOIN labelings ON labelings.classification_id=classifications.id"
24
+ options[:conditions] = filter.to_condition
25
+ options[:group] = "assets.id HAVING COUNT(label_id)=#{filter.size}"
26
+ end
27
+ all options
28
+ end
29
+
30
+ def self.count_for_labels(filter)
31
+ options = {:include => [:labelings], :group => "label_id"}
32
+ unless filter.empty?
33
+ options[:conditions] = "assets.id IN(
34
+ SELECT DISTINCT assets.id
35
+ FROM assets
36
+ LEFT OUTER JOIN classifications ON (assets.id = classifications.asset_id)
37
+ LEFT OUTER JOIN labelings ON (labelings.classification_id=classifications.id)
38
+ WHERE (#{filter.to_condition})
39
+ GROUP BY assets.id
40
+ HAVING COUNT(label_id)=#{filter.size})"
41
+ filter.to_condition
42
+ end
43
+ count options
44
+ end
45
+
46
+ def put_on_tray
47
+ return if user.nil?
48
+
49
+ tray_positions.create(:user_id => user.id, :asset_id => id, :position => user.tray_positions.maximum(:position) ? user.tray_positions.maximum(:position)+1 : 1)
50
+ end
51
+ end
52
+
@@ -0,0 +1,16 @@
1
+ class Catalog < ActiveRecord::Base
2
+ has_many :facets, :include => :labels, :dependent => :destroy
3
+ has_many :classifications, :dependent => :destroy
4
+ has_many :assets, :through => :classifications
5
+
6
+ validates_presence_of :title
7
+
8
+
9
+
10
+ #has_permalink :title
11
+
12
+ #def to_param
13
+ # "#{id}-#{permalink}"
14
+ #end
15
+ end
16
+
@@ -0,0 +1,8 @@
1
+ class Classification < ActiveRecord::Base
2
+ belongs_to :catalog
3
+ has_many :labelings, :dependent => :destroy
4
+ has_many :labels, :through => :labelings
5
+ belongs_to :asset, :counter_cache => true
6
+ validates_presence_of :asset
7
+ end
8
+
@@ -0,0 +1,19 @@
1
+ class Facet < ActiveRecord::Base
2
+ LABEL_ORDER = [["ascending", "value ASC, caption ASC"],
3
+ ["descending", "value DESC, caption DESC"],
4
+ ["manual", "position"]]
5
+
6
+ belongs_to :catalog
7
+ has_many :labels, :dependent => :destroy
8
+ validates_presence_of :caption
9
+
10
+ scope :exclude, lambda {|ids|
11
+ { :conditions => ["id NOT IN(?)", ids]}
12
+ }
13
+
14
+ def ordered_labels
15
+ #self.labels.find(:all, :order => self.label_order)
16
+ self.labels.order(self.label_order)
17
+ end
18
+ end
19
+
@@ -0,0 +1,11 @@
1
+ class Label < ActiveRecord::Base
2
+ belongs_to :facet
3
+ has_many :labelings, :dependent => :destroy
4
+ has_many :classifications, :through => :labelings
5
+
6
+ validates_presence_of :caption
7
+ scope :in, lambda {|ids|
8
+ {:conditions => ['labels.id IN (?)', ids], :include => :facet, :order => "facet_id"}
9
+ }
10
+ end
11
+
@@ -0,0 +1,16 @@
1
+ class LabelFilter < Array
2
+ def initialize(filter_query)
3
+ label_ids = (filter_query || "").split('-').map{|id| id.to_i}
4
+ super(label_ids)
5
+ end
6
+ def to_condition
7
+ "labelings.label_id IN(#{self.join(',')})"
8
+ end
9
+ def to_query_include(id)
10
+ (self + [id]).join('-')
11
+ end
12
+ def to_query_exclude(id)
13
+ self.reject{|i| i == id}.join('-')
14
+ end
15
+ end
16
+
@@ -0,0 +1,5 @@
1
+ class Labeling < ActiveRecord::Base
2
+ belongs_to :label
3
+ belongs_to :classification
4
+ end
5
+
@@ -0,0 +1,9 @@
1
+ class TrayPosition < ActiveRecord::Base
2
+ belongs_to :asset, :include => :content
3
+ belongs_to :user
4
+ belongs_to :clipboard, :polymorphic => true
5
+ validates_associated :asset, :clipboard
6
+ validates_presence_of :position
7
+ #validates_uniqueness_of :asset_id, :scope => [:user_id], :message => "Asset is already on tray!"
8
+ end
9
+
@@ -0,0 +1,8 @@
1
+ %ul.asset_type_list
2
+ - @asset_types.each do |type|
3
+ %li.asset_type
4
+ .item
5
+ =link_to type[:name].to_s,
6
+ "#",
7
+ :class => @selected_type == type[:name] ? "selected" : "",
8
+ :data => { :asset_type => type[:name]}
@@ -0,0 +1,33 @@
1
+ .classification_form
2
+ =form_for Classification.new(:asset_id => @content.asset.id), :url => main_app.classifications_path do |f|
3
+ %p
4
+ %label{:for => 'catalog_id'} New:
5
+ =select("classification", "catalog_id", Catalog.all.inject([]){|m,c| m << [c.title, c.id]})
6
+ =hidden_field_tag "classification[asset_id]", @content.asset.id.to_s
7
+ =submit_tag "Create", :class => "classification_create"
8
+
9
+
10
+ .classification_sidebar
11
+ .title Classifications
12
+ %ul.collection
13
+ -catalogs = []
14
+ -@content.asset.classifications.each do |classification|
15
+ -catalogs << classification.catalog_id
16
+ %li.classification
17
+ .content
18
+ =form_for classification, :remote => true , :url => main_app.classification_path(classification) do |f|
19
+ .classification_header
20
+ =link_to classification.catalog.title, main_app.catalog_path(classification.catalog), :class => "classification_title"
21
+ =submit_tag "Drop", :class => "classification_drop", :classification_id => classification.id
22
+ .classification_facets
23
+ -classification.catalog.facets.each do |facet|
24
+ .facet{:class => "#{facet.color}_lite"}
25
+ .caption{:class => facet.color}
26
+ =facet.caption
27
+ %ul
28
+ -facet.labels.each do |label|
29
+ %li.label
30
+ =check_box_tag "labels[]", label.id, classification.label_ids.include?(label.id)
31
+ =link_to label.caption
32
+ =submit_tag "Save"
33
+
@@ -0,0 +1,30 @@
1
+ -unless new
2
+ #edit_header
3
+ #content
4
+ #messages
5
+ #type
6
+ =@content.media_type.capitalize
7
+ #action
8
+ %span.action
9
+ =button_to "Delete", asset_content_path(@content),
10
+ :method => :delete,
11
+ :onclick => "return confirm('Are you sure?')",
12
+ :class => "delete_asset_button"
13
+ =render :partial => "assets/put_on_tray"
14
+ =render :partial => "#{@content.class.to_s.underscore.pluralize}/actions" rescue nil
15
+ #asset_preview
16
+ =render content_partial(@content, :preview)
17
+
18
+ #asset_form
19
+ =form_for @content, :url => asset_content_path(@content), :html => {:class => "fassets_core asset_form", :multipart => true} do |f|
20
+ =render :partial => "shared/error", :locals => {:target => @content}
21
+ =fields_for "asset", @content.asset do |asset|
22
+ %p
23
+ %label{:for => 'name'} Name:
24
+ =asset.text_field :name
25
+ #name_warning
26
+ =render :partial => "#{@content.class.to_s.underscore.pluralize}/form", :locals => {:new => new}, :object => f
27
+ =submit_tag @content.new_record? ? "Create" : "Save",
28
+ :class => "asset_submit_button",
29
+ :data => { :asset_id => @content.asset.id, :asset_type => @content.asset.content_type, :content_id => @content.id }
30
+
@@ -0,0 +1,7 @@
1
+ -if user_signed_in?
2
+ -unless TrayPosition.where(:asset_id => @content.asset.id, :user_id => current_user.id).exists?
3
+ -tp = TrayPosition.new(:asset_id => @content.asset.id, :user_id => current_user.id)
4
+ =form_for [current_user, tp], :url => main_app.user_tray_positions_path(current_user,tp), :html => {:class => "inline"} do |f|
5
+ =f.hidden_field :asset_id
6
+ =f.hidden_field :user_id
7
+ =submit_tag "-> Tray", :class => "put_on_tray_button", :data => { :asset_id => @content.asset.id, :user_id => current_user.id }
@@ -0,0 +1,15 @@
1
+ =content_for :h1 do
2
+ #type
3
+ =@content.media_type.capitalize
4
+ #title
5
+ =link_to @content.asset.name, asset_content_path(@content)
6
+ #action
7
+ %span.action
8
+ =button_to "Delete", asset_content_path(@content), :method => :delete, :onclick => "return confirm('Are you sure?')"
9
+ =render :partial => "assets/put_on_tray"
10
+
11
+ #sidebar.fassets_core
12
+ =render :partial => "assets/classification", :locals => {:asset => @content.asset}
13
+ =render :partial => "#{@content.class.to_s.underscore.pluralize}/sidebar"
14
+ #main.fassets_core
15
+ =render :partial => "assets/form", :locals => {:new => false}
@@ -0,0 +1,25 @@
1
+ -content_for :h1 do
2
+ #type
3
+ =@content.class.to_s
4
+ #name
5
+ New
6
+
7
+ -unless @asset_types.nil?
8
+ #add_asset_sidebar
9
+ =render :partial => "add_asset_sidebar"
10
+
11
+ -unless @content.nil?
12
+ #add_asset_content
13
+ #main.fassets_core
14
+ =form_for @content, :url => asset_content_path(@content),:html => {:multipart => true} do |f|
15
+ =render :partial => "shared/error", :locals => {:target => @content}
16
+ =fields_for "asset" do |asset|
17
+ %p
18
+ %label{:for => 'name'} Name:
19
+ =asset.text_field :name
20
+ #name_warning
21
+ %p
22
+ %label{:for => 'catalog_id'} Catalog:
23
+ =select("classification", "catalog_id", Catalog.all.inject([]){|m,c| m << [c.title, c.id]})
24
+ =render :partial => @content.class.to_s.underscore.pluralize + "/form", :locals => {:new => true}, :object => f
25
+ =submit_tag "Create", :class => "asset_create_button"
@@ -0,0 +1,13 @@
1
+ #asset_preview
2
+ =render content_partial(@content, :preview)
3
+
4
+ =content_for :h1 do
5
+ #type
6
+ =@content.media_type.capitalize
7
+ #name
8
+ =@content.asset.name
9
+ -if user_signed_in?
10
+ %span.action
11
+ =link_to image_tag("fassets_core/edit.png"), edit_asset_content_path(@content)
12
+ =render :partial => "assets/put_on_tray", :locals => {:current_user => current_user}
13
+
@@ -0,0 +1,6 @@
1
+ -Catalog.all.each do |catalog|
2
+ .catalog_item
3
+ =link_to catalog.title, "/catalog_box?id="+catalog.id.to_s,
4
+ :class => "catalog_list_item",
5
+ :id => selected_catalog == catalog.id ? "selected" : "",
6
+ :data => { :catalog_id => catalog.id }
@@ -0,0 +1,13 @@
1
+ -unless @filter.empty?
2
+ #filter
3
+ %ul
4
+ -Label.in(@filter).each do |filter_item|
5
+ %li.item
6
+ %strong{:class => filter_item.facet.color}="#{filter_item.facet.caption}: #{filter_item.caption}"
7
+ =link_to "drop", "/catalog_box",
8
+ :id => @catalog,
9
+ :filter => @filter.to_query_exclude(filter_item.id),
10
+ :class => "facet_drop_link"
11
+ %li{:style => "clear:both"}=link_to "clear filter", "/catalog_box?id="+@catalog.id.to_s, :class => "clear_filter"
12
+ %ul#assets
13
+ =render :partial => "shared/asset", :collection => @assets, :locals => {:tp => nil}
@@ -0,0 +1,2 @@
1
+ %h2=link_to catalog.title, catalog_path(catalog)
2
+ %p=simple_format catalog.info
@@ -0,0 +1,13 @@
1
+ %li.facet{:id => "facet_"+facet.id.to_s }
2
+ .caption{:class => facet.color}
3
+ =facet.caption
4
+ -if user_signed_in?
5
+ =link_to image_tag("fassets_core/edit.png"), edit_catalog_facet_path(@catalog, facet)
6
+ %span.handle=image_tag("fassets_core/drag.png")
7
+ %ul{:class => "#{facet.color}_lite"}
8
+ -facet.labels.each do |label|
9
+ -if @counts[label.id] && !@filter.include?(label.id)
10
+ %li.label
11
+ =link_to label.caption, catalog_path(@catalog, :filter => @filter.to_query_include(label.id))
12
+ -if @counts[label.id] > 1
13
+ %span.count="#{@counts[label.id]}&#215"
@@ -0,0 +1,3 @@
1
+ %li.item
2
+ %strong{:class => filter_item.facet.color}="#{filter_item.facet.caption}: #{filter_item.caption}"
3
+ =link_to "drop", catalog_path(@catalog, :filter => @filter.to_query_exclude(filter_item.id))
@@ -0,0 +1,6 @@
1
+ %p
2
+ %label{:for => 'title'} Title:
3
+ =text_field :catalog, :title
4
+ %p
5
+ %label{:for => 'info'} Info:
6
+ =text_area :catalog, :info, :rows => 4
@@ -0,0 +1,6 @@
1
+ #catalog_list
2
+ =render :partial => "box_catalog_list", :locals => {:selected_catalog => selected_catalog}
3
+ #box_content
4
+ =render :partial => "box_content"
5
+ #sidebar.fassets_core.box
6
+ =render :partial => "facet", :collection => @catalog.facets, :as => :facet
@@ -0,0 +1,8 @@
1
+
2
+ =content_for :h1 do
3
+ #type Catalog
4
+ #name
5
+ =link_to @catalog.title, catalog_path(@catalog)
6
+ =form_for @catalog, :html => {:class => "fassets_core"} do |f|
7
+ =render :partial => "form", :object => f
8
+ =submit_tag "Save"
@@ -0,0 +1,17 @@
1
+ =content_for :h1 do
2
+ Fassets Development
3
+ #sidebar.fassets_core
4
+ -if user_signed_in?
5
+ .collapsible
6
+ %h2.title New Catalog
7
+ =form_for Catalog.new, :url => catalogs_path do |f|
8
+ =render :partial => "form", :object => f
9
+ =submit_tag "Create"
10
+ %ul.collection
11
+ -Catalog.all.each do |catalog|
12
+ %li
13
+ =link_to(catalog.title, catalog_path(catalog))
14
+ .content=catalog.info
15
+
16
+ #main
17
+
@@ -0,0 +1,8 @@
1
+ =content_for :h1 do
2
+ #type Catalog
3
+ #name
4
+ New
5
+
6
+ =form_for @catalog, :html => {:class => "fassets_core", :multipart => true} do |f|
7
+ =render :partial => "form", :object => f
8
+ =submit_tag "Create"
@@ -0,0 +1,30 @@
1
+ =content_for :h1 do
2
+ #type Catalog
3
+ #name
4
+ =@catalog.title
5
+ -if user_signed_in?
6
+ %span.action
7
+ =link_to image_tag("fassets_core/edit.png"), edit_catalog_path(@catalog)
8
+ #sidebar.fassets_core
9
+ -if user_signed_in?
10
+ .collapsible
11
+ %h2.title Add Facet
12
+ =form_for [@catalog, Facet.new], :url => catalog_facets_path(@catalog, Facet.new) do |f|
13
+ =render :partial => "facets/form", :object => f
14
+ =submit_tag "Create"
15
+ %ol#facets{"data-update-url" => sort_catalog_facets_url(@catalog)}
16
+ =render :partial => "facet", :collection => @catalog.facets.all(:order => "position ASC")
17
+
18
+ #catalog_main
19
+ -if @filter.empty?
20
+ %h2 Assets
21
+ -else
22
+ %h2
23
+ Filtered Assets
24
+ #filter
25
+ %ul
26
+ =render :partial => "filter_item", :collection => Label.in(@filter)
27
+ %li{:style => "clear:both"}=link_to "clear filter", catalog_path(@catalog), :class => "icon remove"
28
+ %ul#assets
29
+ =render :partial => "shared/asset", :collection => @assets, :locals => {:tp => nil}
30
+
@@ -0,0 +1,4 @@
1
+ $("#flash").html("<%= escape_javascript render(:partial => 'shared/flash_messages', :locals => {:flash => flash}) %>");
2
+ $("#message").show("slide", { direction: "left" }).delay(3000).hide("slide", { direction: "left" });
3
+ <% flash.discard %>
4
+