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,32 @@
1
+ $(function(){
2
+ //Sortable Labels
3
+ $('#labels').sortable({
4
+ axis: 'y',
5
+ start: function() {
6
+ $('#labels .handle').bind('click',noEventPropagation);
7
+ },
8
+ stop:function() {
9
+ $('#labels .handle').unbind('click', noEventPropagation);
10
+ },
11
+ update:function(){
12
+ }
13
+ });
14
+
15
+ $(".collapsible").collapsiblePanel({
16
+ collapsedImage: "<%= image_path 'fassets_core/collapsed.png' %>",
17
+ expandedImage: "<%= image_path 'fassets_core/collapse.png' %>",
18
+ titleQuery: "h2.title",
19
+ startCollapsed: true
20
+ });
21
+
22
+ $(".label > input[type=checkbox]").live("click",function() {
23
+ $(this).parents("form").submit();
24
+ });
25
+ // hide the submit button if JS is enabled (form can be submited by checking the boxes)
26
+ $("form.edit_classification input[type=submit][value=Save]").hide();
27
+ });
28
+
29
+ /*$.ajax({
30
+ data:$(this).sortable('serialize') + '&_method=put',
31
+ type:'post', url:'/users/1/tray'
32
+ })*/
@@ -0,0 +1,30 @@
1
+ $(document).ready(function(){
2
+ $('#tray ol').sortable({
3
+ items: 'li',
4
+ connectWith: "ul",
5
+ update: function(ev, ui){
6
+ $.ajax({
7
+ type: 'put',
8
+ data: $('.sortable_tray').sortable('serialize')+"&asset_id="+$(ui.item).data("asset-id"),
9
+ dataType: 'script',
10
+ complete: function(request){
11
+ window.location.reload();
12
+ $('#tray').effect('highlight',{},2000);
13
+ },
14
+ url: "/" + $('.sortable_tray').attr('id').replace(/\./g,"/")})
15
+ },
16
+ });
17
+ $('#tray .drop_button').live("click",function(event){
18
+ event.preventDefault();
19
+ var user_id = $(event.target).data("user-id");
20
+ var tp_id = $(event.target).data("tp-id");
21
+ $.ajax({
22
+ type: 'DELETE',
23
+ cache : false,
24
+ url : "/users/"+user_id+"/tray_positions/"+tp_id,
25
+ success: function(data) {
26
+ $("#tray").load("/users/"+user_id+"/tray_positions/");
27
+ }
28
+ });
29
+ });
30
+ });
@@ -0,0 +1,77 @@
1
+ #add_asset_sidebar {
2
+ position: absolute;
3
+ left: 0;
4
+ top: 0px;
5
+ height: 100%;
6
+ min-width: 150px;
7
+ font-size: 1em;
8
+ padding-right: 0;
9
+ background: silver;
10
+ .asset_type {
11
+ margin-top: .5em;
12
+ padding: .5em .0em .5em .5em;
13
+ .item {
14
+ width: 100%;
15
+ height: 16px;
16
+ a {
17
+ float: right;
18
+ padding: .5em;
19
+ }
20
+ .selected {
21
+ border: 1px solid white;
22
+ border-right: 1px solid white;
23
+ border-right-style: none;
24
+ border-top-left-radius: 10px;
25
+ border-bottom-left-radius: 10px;
26
+ background: white;
27
+ }
28
+ }
29
+ }
30
+ }
31
+ #content {
32
+ position: absolute;
33
+ height: 100%;
34
+ }
35
+ #fancybox-content h1 {
36
+ border-top: none;
37
+ background-color: white;
38
+ }
39
+ #add_asset_content {
40
+ position: relative;
41
+ top: 5px;
42
+ height: 98%;
43
+ left: 150px;
44
+ width: 88%;
45
+ }
46
+ #sidebar.box{
47
+ float: right;
48
+ position: absolute;
49
+ right: 10px;
50
+ top: 5px;
51
+ width: 20%;
52
+ }
53
+ .wiki_results {
54
+ display: inline;
55
+ }
56
+ .wiki_img {
57
+ background: silver;
58
+ float: left;
59
+ margin: 5px;
60
+ }
61
+ #file_asset_form{
62
+ width: 90%;
63
+ height: 50%;
64
+ padding-right: 10px;
65
+ float: left;
66
+ }
67
+ #edit_asset_content{
68
+ width: 98%;
69
+ height: 48%;
70
+ //float: left;
71
+ }
72
+ .wiki_image{
73
+ float:left;
74
+ }
75
+ .wiki_actions{
76
+ padding-left: 5px;
77
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ *= require fancybox
3
+ *= require fassets_core/catalog_box
4
+ *= require fassets_core/add_asset_box
5
+ *= require_self
6
+ *= require fassets_core/master
7
+ *= require fassets_core/assets
8
+ *= require fassets_core/tray
9
+ *= require fassets_core/labels
10
+ *= require fassets_core/forms
11
+ *= require fassets_core/collapsible
12
+ *= require fassets_core/sidebar
13
+ *= require fassets_core/filter
14
+ *= require fassets_core/facet
15
+ *= require fassets_core/edit_box
16
+ */
@@ -0,0 +1,74 @@
1
+ li.asset {
2
+ position: relative;
3
+ display: inline-block;
4
+ width: 100px;
5
+ height: 112px;
6
+ padding: 6px;
7
+ margin: 0 2em .5em 0;
8
+ background: #666666;
9
+ border-radius: 5px;
10
+ border: 2px solid black;
11
+
12
+ .asset_content {
13
+ width: 80px;
14
+ height: 80px;
15
+
16
+ .icon {
17
+ display: block;
18
+ position: relative;
19
+ width: 72px;
20
+ height: 72px;
21
+ padding-top: 4px;
22
+ padding-left: 12px;
23
+ padding-right: 8px;
24
+ padding-bottom: 8px;
25
+
26
+ .thumbnail img {
27
+ border: 2px solid silver;
28
+ }
29
+ }
30
+ .caption {
31
+ display: block;
32
+ background: black;
33
+ color: white;
34
+ position: relative;
35
+ bottom: 2px;
36
+ left: 0px;
37
+ width: 88px;
38
+ border-radius: 5px;
39
+ border: 1px solid black;
40
+ text-align: center;
41
+ margin-left: 4px;
42
+ margin-top: 4px;
43
+ margin-bottom: 2px;
44
+ overflow: hidden;
45
+ text-overflow: ellipsis;
46
+ white-space: nowrap;
47
+ height: 1.5em;
48
+
49
+ a {
50
+ margin-top: 0;
51
+ }
52
+ }
53
+ }
54
+
55
+ .asset_actions {
56
+ width: 55px;
57
+ height: 65px;
58
+ position: absolute;
59
+ left: 112px;
60
+ top: 19px;
61
+ display: none;
62
+ z-index: 10;
63
+ background: #666666;
64
+ border-top-right-radius: 5px;
65
+ border-bottom-right-radius: 5px;
66
+ border: 2px solid black;
67
+ border-left-style: none;
68
+ padding: 3px;
69
+
70
+ input {
71
+ margin: 2px;
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,45 @@
1
+ #catalog_list {
2
+ position: absolute;
3
+ left: 0;
4
+ top: 0px;
5
+ height: 100%;
6
+ font-size: 1em;
7
+ padding-right: 0;
8
+ background: silver;
9
+ .catalog_item {
10
+ margin-top: .5em;
11
+ padding: .5em .0em .5em .5em;
12
+ width: 100%;
13
+ height: 16px;
14
+ a {
15
+ float: right;
16
+ padding: .5em;
17
+ padding-right: 1em;
18
+ }
19
+ #selected {
20
+ border: 1px solid white;
21
+ border-right: 1px solid white;
22
+ border-right-style: none;
23
+ border-top-left-radius: 10px;
24
+ border-bottom-left-radius: 10px;
25
+ background: white;
26
+ }
27
+ }
28
+ }
29
+ #content {
30
+ position: absolute;
31
+ height: 100%;
32
+ }
33
+ #box_content {
34
+ position: relative;
35
+ top: 5px;
36
+ height: 98%;
37
+ left: 200px;
38
+ }
39
+ #sidebar.box{
40
+ float: right;
41
+ position: absolute;
42
+ right: 10px;
43
+ top: 5px;
44
+ width: 20%;
45
+ }
@@ -0,0 +1,54 @@
1
+ .collapsiblePanelTitle {
2
+ display: inline;
3
+
4
+ h2 {
5
+ text-align: left;
6
+ margin-bottom: 0;
7
+ }
8
+
9
+ img {
10
+ margin: 0.2em 0;
11
+ float: left;
12
+ padding-right: 0.5em;
13
+ }
14
+ }
15
+
16
+ .collapsibleContainerContent {
17
+ padding: 10px;
18
+ }
19
+
20
+ .collapsibleContainer {
21
+ border: solid 1px #9BB5C1;
22
+ }
23
+
24
+ .collapsibleContainerTitle {
25
+ cursor:pointer;
26
+ }
27
+
28
+ .collapsibleContainerTitle div {
29
+ padding-top:2px;
30
+ padding-bottom:2px;
31
+ padding-left:10px;
32
+ font-size: 1.4em;
33
+ background-color: #F5F5F5;
34
+ border: solid 1px grey;
35
+ border-bottom-right-radius: 1em;
36
+ border-top-right-radius: 1em;
37
+ border-bottom-left-radius: 1em;
38
+ border-top-left-radius: 1em;
39
+ }
40
+
41
+ .collection .collapsibleContainerTitle div {
42
+ padding-top:2px;
43
+ padding-bottom:2px;
44
+ padding-left:10px;
45
+ font-size: 1.4em;
46
+ border: none;
47
+ background-color: white;
48
+ color: black;
49
+ border-bottom-right-radius: 1em;
50
+ border-top-right-radius: 1em;
51
+ border-bottom-left-radius: 1em;
52
+ border-top-left-radius: 1em;
53
+ }
54
+
@@ -0,0 +1,58 @@
1
+ #fancybox-content #main {
2
+ margin-top: 10px;
3
+ margin-left: 10px;
4
+ height: 95%;
5
+ }
6
+ #fancybox-content #sidebar{
7
+ margin-top: 10px;
8
+ height: 95%;
9
+ }
10
+ #fancybox-content #edit_header{
11
+ margin-bottom: 1em;
12
+ #content {
13
+ height: 40px;
14
+ width: 35%;
15
+ display: inline;
16
+ background-color: #888888;
17
+ border: 2px solid #777777;
18
+ border-radius: 5px;
19
+ #type {
20
+ font-size: 16px;
21
+ color: white;
22
+ text-shadow: 1px 1px #777777;
23
+ padding: .5em;
24
+ float: left;
25
+ }
26
+ #action {
27
+ float: left;
28
+ margin-top: 5px;
29
+ width: 70%;
30
+ .delete_asset_button {
31
+ float: left;
32
+ }
33
+ .put_on_tray_button {
34
+ float: left;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ #fancybox-content #asset_preview{
40
+ padding: 1em;
41
+ margin-top: 50px;
42
+ margin-bottom: 1em;
43
+ margin-right: .5em;
44
+ max-width: 400px;
45
+ overflow: auto;
46
+ background-color: #888888;
47
+ border: 2px solid #777777;
48
+ border-radius: 5px;
49
+ img {
50
+ border: 2px solid silver;
51
+ }
52
+ }
53
+ #asset_form{
54
+ width: 50%;
55
+ height: 50%;
56
+ padding-right: 10px;
57
+ float: left;
58
+ }
@@ -0,0 +1,56 @@
1
+ #sidebar .facet{
2
+ margin-bottom: 1em;
3
+ margin-left: 0.5em;
4
+ margin-right: 0.5em;
5
+ -webkit-border-radius: 5px;
6
+ -webkit-border-radius: 5px;
7
+ border-top-left-radius: 5px;
8
+ border-top-right-radius: 5px;
9
+
10
+ ul {
11
+ padding: .3em;
12
+ }
13
+
14
+ .action {
15
+ text-align: right;
16
+ }
17
+
18
+ .label {
19
+ display: inline-block;
20
+ padding-right: .8em;
21
+ white-space: nowrap;
22
+
23
+ .count {
24
+ font-size: .8em;
25
+ }
26
+ }
27
+
28
+ .caption {
29
+ -webkit-border-top-left-radius: 5px;
30
+ -webkit-border-top-right-radius: 5px;
31
+ border-top-left-radius: 5px;
32
+ border-top-right-radius: 5px;
33
+ color: white;
34
+ padding: .2em .5em;
35
+ font-weight: bold;
36
+
37
+ a {
38
+ color: white;
39
+ text-decoration: none;
40
+ }
41
+
42
+ a:hover {
43
+ text-decoration: underline;
44
+ }
45
+ }
46
+
47
+ .labels {
48
+ padding: .5em;
49
+ }
50
+
51
+ .handle {
52
+ color: white;
53
+ float: right;
54
+ }
55
+ }
56
+