redditor 0.1.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 (166) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +27 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +8 -0
  5. data/Gemfile +23 -0
  6. data/Guardfile +24 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.md +16 -0
  9. data/Rakefile +23 -0
  10. data/app/assets/images/redditor/.keep +0 -0
  11. data/app/assets/images/redditor/add_photo.png +0 -0
  12. data/app/assets/images/redditor/add_photo_big.png +0 -0
  13. data/app/assets/images/redditor/add_slider.png +0 -0
  14. data/app/assets/images/redditor/add_slider_big.png +0 -0
  15. data/app/assets/images/redditor/add_txt.png +0 -0
  16. data/app/assets/images/redditor/add_txt_big.png +0 -0
  17. data/app/assets/images/redditor/add_video.png +0 -0
  18. data/app/assets/images/redditor/add_video_big.png +0 -0
  19. data/app/assets/images/redditor/destroy_block_text.png +0 -0
  20. data/app/assets/images/redditor/move_handler.png +0 -0
  21. data/app/assets/images/redditor/no_format_text.png +0 -0
  22. data/app/assets/images/redditor/trash.png +0 -0
  23. data/app/assets/javascripts/fileapi/FileAPI.exif.js +59 -0
  24. data/app/assets/javascripts/fileapi/FileAPI.flash.image.swf +0 -0
  25. data/app/assets/javascripts/fileapi/FileAPI.flash.swf +0 -0
  26. data/app/assets/javascripts/fileapi/FileAPI.id3.js +67 -0
  27. data/app/assets/javascripts/fileapi/FileAPI.min.js +73 -0
  28. data/app/assets/javascripts/fileapi/fileapi.js.coffee.erb +12 -0
  29. data/app/assets/javascripts/fileapi/tmpl.js +35 -0
  30. data/app/assets/javascripts/fileapi/uploader.coffee +139 -0
  31. data/app/assets/javascripts/jquery-ui.min.js +12 -0
  32. data/app/assets/javascripts/redditor/application.js +14 -0
  33. data/app/assets/javascripts/redditor/fileapi/FileAPI.exif.js +59 -0
  34. data/app/assets/javascripts/redditor/fileapi/FileAPI.flash.image.swf +0 -0
  35. data/app/assets/javascripts/redditor/fileapi/FileAPI.flash.swf +0 -0
  36. data/app/assets/javascripts/redditor/fileapi/FileAPI.id3.js +67 -0
  37. data/app/assets/javascripts/redditor/fileapi/FileAPI.min.js +72 -0
  38. data/app/assets/javascripts/redditor/fileapi/README.md +724 -0
  39. data/app/assets/javascripts/redditor/fileapi/config.js.coffee.erb +5 -0
  40. data/app/assets/javascripts/redditor/fileapi/crossdomain.xml +19 -0
  41. data/app/assets/javascripts/redditor/fileapi/example.userpic.html +212 -0
  42. data/app/assets/javascripts/redditor/fileapi/index.html +548 -0
  43. data/app/assets/javascripts/redditor/fileapi/mailru.js +6 -0
  44. data/app/assets/javascripts/redditor/fileapi/mailru_front.js.coffee +143 -0
  45. data/app/assets/javascripts/redditor/fileapi/tmpl.js +35 -0
  46. data/app/assets/javascripts/redditor/fileapi/uploader.coffee +139 -0
  47. data/app/assets/javascripts/redditor/redditor.coffee +148 -0
  48. data/app/assets/stylesheets/redditor/application.css.scss +47 -0
  49. data/app/assets/stylesheets/redditor/fileapi/fileapi.css.scss +174 -0
  50. data/app/assets/stylesheets/redditor/fileapi/fileapi_front.css.scss +175 -0
  51. data/app/assets/stylesheets/redditor/redditor.css.scss +108 -0
  52. data/app/controllers/redditor/admin/base_controller.rb +18 -0
  53. data/app/controllers/redditor/admin/image_blocks_controller.rb +37 -0
  54. data/app/controllers/redditor/admin/images_controller.rb +33 -0
  55. data/app/controllers/redditor/admin/pages_controller.rb +15 -0
  56. data/app/controllers/redditor/admin/slider_blocks_controller.rb +32 -0
  57. data/app/controllers/redditor/admin/text_blocks_controller.rb +31 -0
  58. data/app/controllers/redditor/admin/video_blocks_controller.rb +31 -0
  59. data/app/controllers/redditor/application_controller.rb +4 -0
  60. data/app/helpers/redditor/application_helper.rb +4 -0
  61. data/app/helpers/redditor/fileapi_helper.rb +17 -0
  62. data/app/helpers/redditor/pages_helper.rb +24 -0
  63. data/app/models/redditor/content_block.rb +24 -0
  64. data/app/models/redditor/image.rb +29 -0
  65. data/app/models/redditor/page.rb +28 -0
  66. data/app/models/redditor/slider_block.rb +17 -0
  67. data/app/models/redditor/text_block.rb +20 -0
  68. data/app/models/redditor/video_block.rb +27 -0
  69. data/app/uploaders/redditor_uploader.rb +57 -0
  70. data/app/views/layouts/redditor/application.html.erb +15 -0
  71. data/app/views/redditor/admin/pages/_content_block.haml +16 -0
  72. data/app/views/redditor/admin/pages/_fileapi.erb +199 -0
  73. data/app/views/redditor/admin/pages/_image.haml +18 -0
  74. data/app/views/redditor/admin/pages/_page.haml +13 -0
  75. data/app/views/redditor/admin/pages/_slider_block.haml +16 -0
  76. data/app/views/redditor/admin/pages/_slider_block_image.haml +3 -0
  77. data/app/views/redditor/admin/pages/_text_block.haml +5 -0
  78. data/app/views/redditor/admin/pages/_validate.haml +4 -0
  79. data/app/views/redditor/admin/pages/_video_block.haml +19 -0
  80. data/app/views/redditor/admin/pages/_wrap_dd.haml +1 -0
  81. data/app/views/redditor/admin/pages/_wrapper.haml +3 -0
  82. data/app/views/redditor/admin/pages/new.js.coffee +7 -0
  83. data/app/views/redditor/admin/pages/new.js.erb +7 -0
  84. data/app/views/redditor/admin/pages/slider_block_image.js.coffee +2 -0
  85. data/app/views/redditor/admin/pages/wrapper.js.coffee +6 -0
  86. data/app/views/redditor/pages/_page.html.haml +1 -0
  87. data/app/views/redditor/slider_blocks/_slider_block.html.haml +2 -0
  88. data/app/views/redditor/slider_blocks/_slider_block_image.html.erb +3 -0
  89. data/app/views/redditor/text_blocks/_text_block.html.haml +1 -0
  90. data/app/views/redditor/video_blocks/_video_block.html.haml +2 -0
  91. data/bin/rails +8 -0
  92. data/config/locales/redditor.en.yml +20 -0
  93. data/config/locales/redditor.ru.yml +20 -0
  94. data/config/routes.rb +17 -0
  95. data/db/migrate/20130916155124_create_redditor_images.rb +15 -0
  96. data/db/migrate/20130916155156_create_redditor_pages.rb +12 -0
  97. data/db/migrate/20130916155219_create_redditor_slider_blocks.rb +11 -0
  98. data/db/migrate/20130916155239_create_redditor_text_blocks.rb +12 -0
  99. data/db/migrate/20130916155301_create_redditor_video_blocks.rb +14 -0
  100. data/lib/generators/redditor/views/views_generator.rb +17 -0
  101. data/lib/redditor/engine.rb +12 -0
  102. data/lib/redditor/has_redditor.rb +17 -0
  103. data/lib/redditor/version.rb +3 -0
  104. data/lib/redditor.rb +9 -0
  105. data/lib/tasks/redditor_tasks.rake +4 -0
  106. data/redditor.gemspec +38 -0
  107. data/spec/dummy/.rspec +1 -0
  108. data/spec/dummy/README.rdoc +28 -0
  109. data/spec/dummy/Rakefile +6 -0
  110. data/spec/dummy/app/assets/images/.keep +0 -0
  111. data/spec/dummy/app/assets/javascripts/application.js +17 -0
  112. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  113. data/spec/dummy/app/controllers/admin/articles_controller.rb +23 -0
  114. data/spec/dummy/app/controllers/admin/base_controller.rb +6 -0
  115. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  116. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  117. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  118. data/spec/dummy/app/mailers/.keep +0 -0
  119. data/spec/dummy/app/models/.keep +0 -0
  120. data/spec/dummy/app/models/article.rb +7 -0
  121. data/spec/dummy/app/models/concerns/.keep +0 -0
  122. data/spec/dummy/app/views/admin/articles/edit.html.haml +15 -0
  123. data/spec/dummy/app/views/articles/show.html.haml +2 -0
  124. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  125. data/spec/dummy/bin/bundle +3 -0
  126. data/spec/dummy/bin/rails +4 -0
  127. data/spec/dummy/bin/rake +4 -0
  128. data/spec/dummy/config/application.rb +31 -0
  129. data/spec/dummy/config/boot.rb +5 -0
  130. data/spec/dummy/config/database.yml +25 -0
  131. data/spec/dummy/config/environment.rb +5 -0
  132. data/spec/dummy/config/environments/development.rb +29 -0
  133. data/spec/dummy/config/environments/production.rb +80 -0
  134. data/spec/dummy/config/environments/test.rb +36 -0
  135. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  136. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  137. data/spec/dummy/config/initializers/inflections.rb +16 -0
  138. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  139. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  140. data/spec/dummy/config/initializers/session_store.rb +3 -0
  141. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  142. data/spec/dummy/config/locales/en.yml +23 -0
  143. data/spec/dummy/config/routes.rb +10 -0
  144. data/spec/dummy/config.ru +4 -0
  145. data/spec/dummy/db/migrate/20130908123351_create_articles.rb +9 -0
  146. data/spec/dummy/db/schema.rb +76 -0
  147. data/spec/dummy/lib/assets/.keep +0 -0
  148. data/spec/dummy/log/.keep +0 -0
  149. data/spec/dummy/public/404.html +58 -0
  150. data/spec/dummy/public/422.html +58 -0
  151. data/spec/dummy/public/500.html +57 -0
  152. data/spec/dummy/public/favicon.ico +0 -0
  153. data/spec/factories/articles_factory.rb +27 -0
  154. data/spec/factories/redditor/images_factory.rb +9 -0
  155. data/spec/factories/redditor/pages_factory.rb +37 -0
  156. data/spec/factories/redditor/sliders_factory.rb +9 -0
  157. data/spec/factories/redditor/texts_factory.rb +5 -0
  158. data/spec/factories/redditor/videos_factories.rb +7 -0
  159. data/spec/features/text_spec.rb +52 -0
  160. data/spec/features/video_spec.rb +52 -0
  161. data/spec/fixtures/test.jpg +0 -0
  162. data/spec/generators/views_generator_spec.rb +20 -0
  163. data/spec/models/article_spec.rb +40 -0
  164. data/spec/spec_helper.rb +67 -0
  165. data/spec/views/article/show_spec.rb +22 -0
  166. metadata +480 -0
@@ -0,0 +1,35 @@
1
+ // Simple JavaScript Templating
2
+ // John Resig - http://ejohn.org/ - MIT Licensed
3
+ (function (){
4
+ var cache = {};
5
+
6
+ this.tmpl = function tmpl(str, data){
7
+ // Figure out if we're getting a template, or if we need to
8
+ // load the template - and be sure to cache the result.
9
+ var fn = !/\W/.test(str) ?
10
+ cache[str] = cache[str] ||
11
+ tmpl(document.getElementById(str).innerHTML) :
12
+
13
+ // Generate a reusable function that will serve as a template
14
+ // generator (and which will be cached).
15
+ new Function("obj",
16
+ "var p=[],print=function(){p.push.apply(p,arguments);};" +
17
+
18
+ // Introduce the data as local variables using with(){}
19
+ "with(obj){p.push('" +
20
+
21
+ // Convert the template into pure JavaScript
22
+ str
23
+ .replace(/[\r\t\n]/g, " ")
24
+ .split("<%").join("\t")
25
+ .replace(/((^|%>)[^\t]*)'/g, "$1\r")
26
+ .replace(/\t=(.*?)%>/g, "',$1,'")
27
+ .split("\t").join("');")
28
+ .split("%>").join("p.push('")
29
+ .split("\r").join("\\'")
30
+ + "');}return p.join('');");
31
+
32
+ // Provide some basic currying to the user
33
+ return data ? fn(data) : fn;
34
+ };
35
+ })();
@@ -0,0 +1,139 @@
1
+ window.FU =
2
+ config:
3
+ maxFileSizeMB: 10
4
+ messages:
5
+ error: "Ошибка"
6
+ done: "Загружено"
7
+ data: ->
8
+ icon:
9
+ image: "//cdn1.iconfinder.com/data/icons/humano2/32x32/apps/synfig_icon.png"
10
+
11
+ files: []
12
+ index: 0
13
+ active: false
14
+
15
+ add: (file) ->
16
+ FU.files.push file
17
+ if /^image/.test(file.type)
18
+ FileAPI.Image(file).preview(35).rotate("auto").get (err, img) ->
19
+ FU._getEl(file, ".js-left").addClass("b-file__left_border").html img unless err
20
+
21
+ getFileById: (id) ->
22
+ i = FU.files.length
23
+ return FU.files[i] if FileAPI.uid(FU.files[i]) is id while i--
24
+
25
+ start: ->
26
+ FU._upload FU.files[FU.index] if not FU.active and (FU.active = FU.files.length > FU.index)
27
+
28
+ abort: (id) ->
29
+ file = @getFileById(id)
30
+ file.xhr.abort() if file.xhr
31
+
32
+ _getEl: (file, sel) ->
33
+ $el = $("#file-" + FileAPI.uid(file))
34
+ (if sel then $el.find(sel) else $el)
35
+
36
+ _upload: (file) ->
37
+ if file
38
+ FileAPI.upload(
39
+ url: FU.config.uploadUrl+"?authenticity_token=#{encodeURIComponent($("meta[name=\"csrf-token\"]").attr("content"))}"
40
+ data: FU.config.data()
41
+ dataType: "script"
42
+
43
+ files:
44
+ file: file
45
+
46
+ upload: ->
47
+ FU._getEl(file).addClass "b-file_upload"
48
+ FU._getEl(file, ".js-progress").css(opacity: 0).show().animate
49
+ opacity: 1
50
+ , 100
51
+
52
+ progress: (evt) ->
53
+ FU._getEl(file, ".js-bar").css "width", evt.loaded / evt.total * 100 + "%"
54
+
55
+ complete: (err, xhr) ->
56
+ setTimeout(xhr.responseText, 10)
57
+
58
+ state = (if err then "error" else "done")
59
+ FU._getEl(file).removeClass "b-file_upload"
60
+ FU._getEl(file, ".js-progress").animate
61
+ opacity: 0
62
+ , 200, ->
63
+ $(@).hide().closest("div.js-file").delay(1000).fadeOut 200, ->
64
+ $(@).remove()
65
+
66
+ FU._getEl(file, ".js-info").append ", <b class=\"b-file__" + state + "\">" + ((if err then (xhr.statusText or err) else FU.config.messages[state])) + "</b>"
67
+ FU.index++
68
+ FU.active = false
69
+ FU.start()
70
+ )
71
+
72
+ template: '<div id="file-<%=FileAPI.uid(file)%>" class="js-file b-file b-file_<%=file.type.split("/")[0]%>">
73
+ <div class="js-left b-file__left">
74
+ <img src="<%=icon[file.type.split("/")[0]]||icon.def%>" width="32" height="32" style="margin: 2px 0 0 3px"/>
75
+ </div>
76
+ <div class="b-file__right">
77
+ <div class="js-name b-file__name"><%=file.name%></div>
78
+ <div class="js-info b-file__info">Размер: <%=(file.size/FileAPI.KB).toFixed(2)%> KB</div>
79
+ <div class="js-progress b-file__bar" style="display: none">
80
+ <div class="b-progress"><div class="js-bar b-progress__bar"></div></div>
81
+ </div>
82
+ </div>
83
+ <i class="js-abort b-file__abort" title="abort">&times;</i>
84
+ </div>'
85
+
86
+
87
+ window.onFiles = (files, context) ->
88
+ $context = $(context)
89
+ if uploadUrl = $context.data("upload-url")
90
+ FU.config.uploadUrl = uploadUrl
91
+
92
+ if contentBlockId = $context.data("content-block-id")
93
+ FU.config.data = ->
94
+ REDDE.redditor.parameterizationForm $context.closest("dd")
95
+ else
96
+ FU.config.data = ->
97
+
98
+ FileAPI.each files, (file) ->
99
+ if file.size >= FU.config.maxFileSizeMB * FileAPI.MB
100
+ alert "Sorrow.\nMax size #{FU.config.maxFileSizeMB}MB"
101
+ else if file.size is undefined
102
+ $("#oooops").show()
103
+ $("#buttons-panel").hide()
104
+ else
105
+ $("#preview").append tmpl(window.FU.template,
106
+ file: file
107
+ icon: FU.icon
108
+ )
109
+ FU.add file
110
+ FU.start()
111
+
112
+ $ ->
113
+ unless FileAPI.support.cors or FileAPI.support.flash
114
+ $("<div />",
115
+ class: "alert"
116
+ html: "Увы, ваш браузер не поддерживает html5 и flash, поэтому смотреть тут нечего, а iframe не даёт всей красоты :]"
117
+ ).insertAfter "#page-header" # если загрузка не поддерживается, то выводим сообщение
118
+ $('#buttons-panel').hide()
119
+
120
+
121
+ if FileAPI.support.dnd
122
+ $('#drag-n-drop').show() #выводим текст с сообщение что работает dnd
123
+ $(document).dnd (over) ->
124
+ $('#drop-zone').toggleClass "active", over #Если кто-то перетащил файлы в браузер подсвечиваем область в которую их можно бросить
125
+ return
126
+ , ->
127
+ $('#drop-zone').dnd (over) ->
128
+ return
129
+ , (files) ->
130
+ onFiles files, this
131
+ return
132
+
133
+ $(document).on 'change', 'input[type="file"][name="files"]', (evt) ->
134
+ files = FileAPI.getFiles(evt)
135
+ onFiles(files, this)
136
+ FileAPI.reset(evt.currentTarget)
137
+ return
138
+
139
+ return
@@ -0,0 +1,148 @@
1
+ window.REDDE = {redditor: {}}
2
+ REDDE.redditor.sliderBlockImagesSortableParams =
3
+ scroll: false
4
+ dropOnEmpty: false
5
+ cursor: "crosshair"
6
+ opacity: 0.75
7
+ items: "li"
8
+ update: ->
9
+ self = $(@)
10
+ $.ajax
11
+ data: self.sortable('serialize') + '&authenticity_token=#{u(form_authenticity_token)}'
12
+ dataType: 'script'
13
+ url: self.data("sortable-url")
14
+ .done ->
15
+ # console.log
16
+ return
17
+ .error ->
18
+ alert "Ошибка, данные не сохранены"
19
+
20
+ REDDE.redditor.parameterizationForm = (box) ->
21
+ form = box.serializeForm()
22
+ formName = box.find("div.form-name").data("object-name")
23
+ firstProperty = formName.replace(/^(.*?)\[.*/,"$1")
24
+ nextProperties = formName.match(/\[(.*?)\]/g)
25
+ nextProperties = $.map nextProperties, (n)->
26
+ n.replace(/\[(.*)\]/,"$1")
27
+ params = form[firstProperty]
28
+ for i in nextProperties
29
+ params = params[i]
30
+ params = "content_block": params
31
+
32
+
33
+ REDDE.redditor.setPositions = ->
34
+ $el = REDDE.redditor.$el
35
+ $el.find($el.sortable("option", "items")).each (i) ->
36
+ $(this).find("input.js-position").val i # временное решение с input type=number
37
+
38
+ REDDE.redditor.sortList = ->
39
+ sortArray = $.map REDDE.redditor.$el.find("dd"), (n) ->
40
+ key = $(n).attr("class")
41
+ input = $(n).find("input[type=hidden][name='#{$(n).find("div.form-name").data("object-name")}[id]']")
42
+ value = input.val()
43
+ # console.log input, value
44
+ if value?
45
+ obj = {}
46
+ obj[key] =
47
+ index: value
48
+ position: $(n).index()
49
+ obj
50
+ else
51
+ null
52
+
53
+ # console.log sortArray
54
+
55
+ if sortArray.length
56
+ $.ajax
57
+ type: "post"
58
+ # data: self.sortable('serialize') + '&authenticity_token=<%= u(form_authenticity_token) %>',
59
+ data: {sort: sortArray}
60
+ dataType: "script"
61
+ url: REDDE.redditor.$el.data("sort-url")
62
+ .done(REDDE.redditor.setPositions)
63
+ else
64
+ REDDE.redditor.setPositions()
65
+
66
+ $ ->
67
+ REDDE.redditor.$el = $("dl.redditor").first()
68
+
69
+ $(".add_fields").click ->
70
+ time = new Date().getTime()
71
+ regexp = new RegExp($(this).data("id"), "g")
72
+ self = REDDE.redditor.$el.append($(this).data("fields").replace(regexp, time))
73
+ REDDE.redditor.setPositions()
74
+
75
+ REDDE.redditor.$el.sortable
76
+ dropOnEmpty: false
77
+ cursor: "crosshair"
78
+ opacity: 0.75
79
+ handle: ".handle"
80
+ axis: "y"
81
+ items: "dd"
82
+ scroll: false
83
+ update: REDDE.redditor.sortList
84
+ start: ->
85
+ # необходимо обновить, чтобы сортировака работала корректно, тк меняем высоту блоков
86
+ $(@).addClass("now-sortable").sortable( "refresh" )
87
+ return
88
+ stop: ->
89
+ $(@).removeClass("now-sortable")
90
+ return
91
+
92
+ .on "ajax:beforeSend", "a.update-data", (event, xhr, status) ->
93
+ box = $(@).closest "dd"
94
+ params = REDDE.redditor.parameterizationForm(box)
95
+ status.url += "?" + $.param(params)
96
+
97
+ $("ul.slider-block-images").sortable REDDE.redditor.sliderBlockImagesSortableParams
98
+
99
+ $('div.redditor-add-blocks').on "ajax:beforeSend", "a.new-block", (event, xhr, status) ->
100
+ status.url += "?" + $.param(content_block: {temp_id: new Date().getTime()}) # generate uniq id
101
+
102
+ #! jquery-serializeForm - Make an object out of form elements - v1.1.1 - 2013-01-21
103
+ #* https://github.com/danheberden/jquery-serializeForm
104
+ #* Copyright (c) 2013 Dan Heberden; Licensed MIT
105
+ (($) ->
106
+ $.fn.serializeForm = ->
107
+
108
+ # don't do anything if we didn't get any elements
109
+ return false if @length < 1
110
+ data = {}
111
+ lookup = data #current reference of data
112
+ selector = ":input[type!=\"checkbox\"][type!=\"radio\"], input:checked"
113
+ parse = ->
114
+
115
+ # data[a][b] becomes [ data, a, b ]
116
+ named = @name.replace(/\[([^\]]+)?\]/g, ",$1").split(",")
117
+ cap = named.length - 1
118
+ $el = $(this)
119
+
120
+ # Ensure that only elements with valid `name` properties will be serialized
121
+ if named[0]
122
+ i = 0
123
+
124
+ while i < cap
125
+
126
+ # move down the tree - create objects or array if necessary
127
+ lookup = lookup[named[i]] = lookup[named[i]] or ((if named[i + 1] is "" then [] else {}))
128
+ i++
129
+
130
+ # at the end, push or assign the value
131
+ if lookup.length isnt `undefined`
132
+ lookup.push $el.val()
133
+ else
134
+ lookup[named[cap]] = $el.val()
135
+
136
+ # assign the reference back to root
137
+ lookup = data
138
+
139
+
140
+ # first, check for elements passed into this function
141
+ @filter(selector).each parse
142
+
143
+ # then parse possible child elements
144
+ @find(selector).each parse
145
+
146
+ # return data
147
+ data
148
+ ) jQuery
@@ -0,0 +1,47 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require redditor/redditor
12
+ */
13
+
14
+ @import "compass";
15
+
16
+ html {
17
+ font: 12px "Lucida Grande", "Lucida Sans Unicode", helvetica, arial, verdana, sans-serif;
18
+ }
19
+
20
+ form.edit_article {
21
+ margin:0 10px;
22
+ }
23
+
24
+ .text-block-input {
25
+ width: 100%;
26
+ @include box-sizing(border-box);
27
+ }
28
+
29
+ input[type=submit] {
30
+ font-size: 2em;
31
+ padding: 0.25em 1.5em;
32
+ display: inline-block;
33
+ background:#ccc;
34
+ cursor: pointer;
35
+ @include background(linear-gradient(#fff, #ccc));
36
+ border-radius: 3px;
37
+ box-shadow: 1px 1px 2px #ccc;
38
+ border: 1px solid #999;
39
+ text-transform: lowercase;
40
+ outline: none;
41
+ &:hover {
42
+ @include background(linear-gradient(rgba(#fff, 0.8), rgba(#ccc, 0.8)));
43
+ }
44
+ &:active {
45
+ @include transform(translateY(1px));
46
+ }
47
+ }
@@ -0,0 +1,174 @@
1
+ @import "compass";
2
+
3
+ #oooops {
4
+ // уведомления о том что ничего не поддерживается кроме фрейма
5
+ display: none;
6
+ border-radius: 4px;
7
+ padding: 10px;
8
+ margin: 10px 0; border: 2px solid #f60;
9
+ }
10
+
11
+ #buttons-panel {
12
+ font-size: 15px;
13
+ font-family: "Helvetica Neue";
14
+ }
15
+
16
+ .b-button {
17
+ display: inline-block;
18
+ *display: inline;
19
+ *zoom: 1;
20
+ position: relative;
21
+ overflow: hidden;
22
+ cursor: pointer;
23
+ padding: 4px 15px;
24
+ vertical-align: middle;
25
+ border: 1px solid #ccc;
26
+ border-radius: 3px;
27
+ background-color: #f5f5f5;
28
+ @include background(linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%));
29
+ -webkit-user-select: none;
30
+ -moz-user-select: none;
31
+ user-select: none;
32
+ &:hover {
33
+ border-color: #fa0;
34
+ box-shadow: 0 0 2px #fa0;
35
+ };
36
+ .b-button__input {
37
+ cursor: pointer;
38
+ @include opacity(0);
39
+ top: -10px;
40
+ right: -40px;
41
+ font-size: 50px;
42
+ position: absolute;
43
+ padding: 50px;
44
+ }
45
+ }
46
+
47
+
48
+
49
+
50
+ #preview {
51
+ box-shadow: 0 1px 3px rgba(0,0,0,.4);
52
+ border-radius: 3px;
53
+ }
54
+
55
+ .b-file {
56
+ padding: 5px;
57
+ position: relative;
58
+ overflow: hidden;
59
+ border-radius: 3px;
60
+ background-color: #fcfcfc;
61
+ background: -webkit-linear-gradient(top, #fcfcfc 0%, #f6f6f6 100%);
62
+ background: -moz-linear-gradient(top, #fcfcfc 0%, #f6f6f6 100%);
63
+ background: -o-linear-gradient(top, #fcfcfc 0%, #f6f6f6 100%);
64
+ background: linear-gradient(to bottom, #fcfcfc 0%, #f6f6f6 100%);
65
+ clear: both;
66
+ }
67
+ .b-file__left {
68
+ float: left;
69
+ margin: 1px 0 0 2px;
70
+ line-height: 0;
71
+ }
72
+ .b-file__left_border {
73
+ border: 2px solid #fff;
74
+ border-radius: 4px;
75
+ }
76
+
77
+ .b-file__right {
78
+ margin-left: 45px;
79
+ }
80
+
81
+ .b-file__name {
82
+ color: #36c;
83
+ }
84
+
85
+ .b-file__info {
86
+ color: #666;
87
+ position: relative;
88
+ font-size: 12px;
89
+ margin-top: 3px;
90
+ }
91
+
92
+ .b-file__bar {
93
+ padding-top: 4px;
94
+ }
95
+
96
+ .b-file__error {
97
+ color: #c00;
98
+ }
99
+ .b-file__done {
100
+ color: #458383;
101
+ }
102
+ .b-file__abort {
103
+ top: 10px;
104
+ right: 20px;
105
+ width: 15px;
106
+ height: 15px;
107
+ position: absolute;
108
+ color: #c00;
109
+ cursor: pointer;
110
+ font-size: 20px;
111
+ display: none;
112
+ }
113
+ .b-file_upload .b-file__abort { display: block; }
114
+
115
+ .b-progress {
116
+ max-width: 200px;
117
+ clear: both;
118
+ height: 10px;
119
+ border: 2px solid #E2E4E2;
120
+ border-radius: 10px;
121
+ box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
122
+ background-color: #d3d3d3;
123
+ position: relative;
124
+ }
125
+ .b-progress__bar {
126
+ width: 0;
127
+ height: 10px;
128
+ border-radius: 10px;
129
+ background-color: #2D9DD7;
130
+ @include background(linear-gradient(top, #2D9DD7 0%, #1C81C7 100%));
131
+ -webkit-transition: width .5s ease-out;
132
+ -moz-transition: width .5s ease-out;
133
+ -ms-transition: width .5s ease-out;
134
+ transition: width .5s ease-out;
135
+ }
136
+
137
+ .b-dropzone {
138
+ position: relative; margin-bottom: 10px;
139
+ &.active {
140
+ }
141
+ }
142
+
143
+ .b-dropzone__bg, .b-dropzone__txt {
144
+ position: absolute;
145
+ .b-dropzone.active & {display: block;}
146
+ }
147
+
148
+ .b-dropzone__bg {
149
+ top: 0;
150
+ left: 0;
151
+ right: 0;
152
+ bottom: 0;
153
+ z-index: 30000;
154
+ opacity: .2;
155
+ background:#EEDA7C;
156
+ .active & {
157
+ background-color: #2D9DD7;
158
+
159
+ }
160
+ }
161
+
162
+ .b-dropzone__txt {
163
+ color: rgb(168, 162, 94);
164
+ .active & {color: #1C81C7;}
165
+ font-size: 16px;
166
+ font-weight: bold;
167
+ text-align: center;
168
+ width: 500px;
169
+ top: 50%;
170
+ left: 50%;
171
+ margin: -50px 0 0 -250px;
172
+ z-index: 30001;
173
+ line-height: 100px;
174
+ }