redditor 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d79d7cca7ef807b71abea058efdaf85807e43824
4
- data.tar.gz: 370f711bb07e75df426a14aaefdce073dba7e657
3
+ metadata.gz: a898a45dff55b68a00cbf7bdc623a09c2d30d4ec
4
+ data.tar.gz: 0e44dca1197cae9e47efce1db64ee3ccd4fe522e
5
5
  SHA512:
6
- metadata.gz: 280d5530c4740cb1fd2fbe834367a800795ad8c7781769dd25dbc19eb82b32f34aab1cbf660e431967b5c400fda701fade9aeb59e5e3f10cb3324c70ad46e10e
7
- data.tar.gz: d767dc371112471e7634e38453af631e17cf21b3eb3331b4a5d5a67cc7bb990d59fd130659a050b025face964c210c01ff898aaf47dd53d88bb34bec096e8413
6
+ metadata.gz: 8893850c838ec8f61e41a08b2c9dfca45fff6cc3ba3fe615c92d5da5f91b661ab7738703cf2a0b3efc7fc23008fb935acb75525b31eecc3d942cece6701a69bc
7
+ data.tar.gz: e8f741718461b281c7531087df09402de04a7a8ff22007fc1cd24e860f0150a3a1a41c50af453a15934d5fcceae35bd73aafa72fc74f816382da137149942c00
data/Gemfile CHANGED
@@ -8,7 +8,8 @@ gem 'haml'
8
8
  gem 'coffee-rails'
9
9
  gem 'jquery-rails'
10
10
  gem 'sass-rails'
11
- gem 'compass-rails', github: 'milgner/compass-rails', ref: '1749c06f15dc4b058427e7969810457213647fb8'
11
+ gem 'fileapi', git: 'git@github.com:redde/fileapi.git'
12
+
12
13
  # Declare your gem's dependencies in redditor.gemspec.
13
14
  # Bundler will treat runtime dependencies like base dependencies, and
14
15
  # development dependencies will be added by default to the :development group.
@@ -11,5 +11,4 @@
11
11
  // about supported directives.
12
12
  //
13
13
  //= require jquery-ui.min.js
14
- //= require redditor/redditor
15
- //= require fileapi/fileapi
14
+ //= require redditor/redditor
@@ -1,3 +1,6 @@
1
+ #= require fileapi
2
+ #= require fileapi/uploader
3
+
1
4
  window.REDDE = {redditor: {}}
2
5
  REDDE.redditor.sliderBlockImagesSortableParams =
3
6
  scroll: false
@@ -33,7 +36,7 @@ REDDE.redditor.parameterizationForm = (box) ->
33
36
  REDDE.redditor.setPositions = ->
34
37
  $el = REDDE.redditor.$el
35
38
  $el.find($el.sortable("option", "items")).each (i) ->
36
- $(this).find("input.js-position").val i # временное решение с input type=number
39
+ $(@).find("input.redditor__position").val i
37
40
 
38
41
  REDDE.redditor.sortList = ->
39
42
  sortArray = $.map REDDE.redditor.$el.find("dd"), (n) ->
@@ -89,14 +92,14 @@ $ ->
89
92
  $(@).removeClass("now-sortable")
90
93
  return
91
94
 
92
- .on "ajax:beforeSend", "a.update-data", (event, xhr, status) ->
95
+ .on "ajax:beforeSend", "a.redditor__update", (event, xhr, status) ->
93
96
  box = $(@).closest "dd"
94
97
  params = REDDE.redditor.parameterizationForm(box)
95
98
  status.url += "?" + $.param(params)
96
99
 
97
100
  $("ul.slider-block-images").sortable REDDE.redditor.sliderBlockImagesSortableParams
98
101
 
99
- $('div.redditor-add-blocks').on "ajax:beforeSend", "a.new-block", (event, xhr, status) ->
102
+ $('div.redditor__add-blocks').on "ajax:beforeSend", "a.redditor__add", (event, xhr, status) ->
100
103
  status.url += "?" + $.param(content_block: {temp_id: new Date().getTime()}) # generate uniq id
101
104
 
102
105
  #! jquery-serializeForm - Make an object out of form elements - v1.1.1 - 2013-01-21
@@ -1,29 +1,29 @@
1
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
- */
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
13
 
14
- @import "compass";
15
-
16
- html {
14
+ html {
17
15
  font: 12px "Lucida Grande", "Lucida Sans Unicode", helvetica, arial, verdana, sans-serif;
18
- }
16
+ }
19
17
 
20
- form.edit_article {
18
+ form.edit_article {
21
19
  margin:0 10px;
22
- }
20
+ }
23
21
 
24
- .text-block-input {
22
+ .text-block-input {
25
23
  width: 100%;
26
- @include box-sizing(border-box);
24
+ -webkit-box-sizing: border-box;
25
+ -moz-box-sizing: border-box;
26
+ box-sizing: border-box;
27
27
  }
28
28
 
29
29
  input[type=submit] {
@@ -32,16 +32,22 @@ input[type=submit] {
32
32
  display: inline-block;
33
33
  background:#ccc;
34
34
  cursor: pointer;
35
- @include background(linear-gradient(#fff, #ccc));
35
+ background:-webkit-linear-gradient(top, #fff, #ccc);
36
+ background:-moz-linear-gradient(top, #fff, #ccc);
37
+ background:-o-linear-gradient(top, #fff, #ccc);
38
+ background:linear-gradient(to bottom, #fff, #ccc);
36
39
  border-radius: 3px;
37
40
  box-shadow: 1px 1px 2px #ccc;
38
41
  border: 1px solid #999;
39
42
  text-transform: lowercase;
40
43
  outline: none;
41
44
  &:hover {
42
- @include background(linear-gradient(rgba(#fff, 0.8), rgba(#ccc, 0.8)));
45
+ background: -webkit-linear-gradient(top, rgba(#fff, 0.8), rgba(#ccc, 0.8));
46
+ background: -moz-linear-gradient(top, rgba(#fff, 0.8), rgba(#ccc, 0.8));
47
+ background: -o-linear-gradient(top, rgba(#fff, 0.8), rgba(#ccc, 0.8));
48
+ background: linear-gradient(to bottom, rgba(#fff, 0.8), rgba(#ccc, 0.8));
43
49
  }
44
50
  &:active {
45
- @include transform(translateY(1px));
51
+ transform: translateY(1px);
46
52
  }
47
53
  }
@@ -1,4 +1,5 @@
1
- @import "compass";
1
+ //= require fileapi
2
+
2
3
  dl.redditor {
3
4
  dd {
4
5
  /*нельзя задавать position-relative, иначе глючит сортировка в хроме*/
@@ -14,21 +15,14 @@ dl.redditor {
14
15
  height: 50px !important; overflow: hidden;
15
16
  .tit-form {display: block;}
16
17
  }
17
- label.delete {
18
- position: absolute; left:100%; bottom: 100%; white-space:nowrap;
19
- @include transform(rotate(90deg));
20
- @include transform-origin(0, 100%);
21
- }
22
18
  .ui-sortable-helper, .ui-sortable-placeholder {
23
19
  /*max-height: 200px !important; overflow: hidden;*/
24
20
  }
25
- .upload-area {
26
- overflow: hidden; margin-top: 10px;
27
- }
28
21
  }
29
22
 
30
23
  ul.slider-block-images {
31
24
  overflow: hidden;
25
+ padding: 0;
32
26
  li {
33
27
  margin: 0 5px 5px 0; list-style: none;
34
28
  float: left; position: relative;
@@ -38,14 +32,12 @@ ul.slider-block-images {
38
32
  }
39
33
  }
40
34
 
41
- div.redditor-add-blocks {
35
+ .redditor__add-blocks {
42
36
  margin:10px -10px; padding:10px;
43
- > p {
44
- overflow: hidden;
45
- }
46
37
  }
47
- .control-data {float: right;}
48
- .delete-data, .update-data {
38
+
39
+ .redditor__control {float: right;}
40
+ .redditor__delete, .redditor__update {
49
41
  text-decoration: none;
50
42
  display: inline-block;
51
43
  text-align: center; min-width: 10px; padding: 0 5px;
@@ -53,51 +45,88 @@ div.redditor-add-blocks {
53
45
  border: 1px solid #C2C2C2; border-radius: 15px;
54
46
  background: #F8F8F8;
55
47
  }
56
- .delete-data { color: #A72522;}
57
- .update-data { color: green;}
48
+
49
+ .redditor__delete {
50
+ color: #A72522;
51
+ &:before {content: '✘'}
52
+ }
53
+ .redditor__update {
54
+ color: green;
55
+ &:before {content: '✔'}
56
+ }
58
57
 
59
58
  .form-name {
60
59
  margin-top: 25px;
61
60
  }
61
+
62
62
  .tit-form {
63
63
  display: none; margin-top: -25px; text-align: center; font-size: 18px;
64
64
  line-height: 30px; vertical-align: middle;
65
65
  img { width: 30px; display: inline-block; vertical-align: middle;}
66
66
  }
67
+
67
68
  .line-form {
68
69
  display: inline-block; margin-right: 5px;
69
70
  }
71
+
70
72
  .del-item {
71
73
  text-decoration: none; position: absolute; right: 1px; bottom: 1px;
72
74
  width: 22px; height: 22px;
73
75
  background: #eee image-url('redditor/trash.png') center no-repeat;
74
76
  border-radius: 15px; border: 1px solid #aaa;
75
77
  }
78
+
76
79
  .full-width {
77
80
  width: 100%; box-sizing: border-box;
78
81
  }
79
- .add-txt, .add-video, .add-photo, .add-slider {
80
- text-decoration: none; color: #222; float: left; padding: 4px 10px 4px 25px;
81
- border-radius: 3px; border: 1px solid #ccc; font-size: 11px; margin-right: 3px;
82
- }
83
- .add-txt {
84
- @include background(image-url('redditor/add_txt.png') 3px center no-repeat, linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%));
85
- }
86
- .add-video {
87
- @include background(image-url('redditor/add_video.png') 3px center no-repeat, linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%));
88
- }
89
- .add-photo {
90
- @include background(image-url('redditor/add_photo.png') 3px center no-repeat, linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%));
82
+
83
+ .redditor__add {
84
+ text-decoration: none;
85
+ color: #222;
86
+ display: inline-block;
87
+ padding: 4px 10px 4px 25px;
88
+ border-radius: 3px;
89
+ border: 1px solid #ccc;
90
+ font-size: 11px; margin-right: 3px;
91
91
  }
92
- .add-slider {
93
- @include background(image-url('redditor/add_slider.png') 3px center no-repeat, linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%));
92
+
93
+ .redditor__add_txt {
94
+ background:#f5f5f5 image-url('redditor/add_txt.png') 3px center no-repeat;
95
+ background: image-url('redditor/add_txt.png') 3px center no-repeat, -webkit-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
96
+ background: image-url('redditor/add_txt.png') 3px center no-repeat, -moz-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
97
+ background: image-url('redditor/add_txt.png') 3px center no-repeat, -o-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
98
+ background: image-url('redditor/add_txt.png') 3px center no-repeat, linear-gradient(to bottom, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
99
+ }
100
+ .redditor__add_video {
101
+ background:#f5f5f5 image-url('redditor/add_video.png') 3px center no-repeat;
102
+ background: image-url('redditor/add_video.png') 3px center no-repeat, -webkit-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
103
+ background: image-url('redditor/add_video.png') 3px center no-repeat, -moz-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
104
+ background: image-url('redditor/add_video.png') 3px center no-repeat, -o-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
105
+ background: image-url('redditor/add_video.png') 3px center no-repeat, linear-gradient(to bottom, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
106
+ }
107
+ .redditor__add_photo {
108
+ background:#f5f5f5 image-url('redditor/add_photo.png') 3px center no-repeat;
109
+ background: image-url('redditor/add_photo.png') 3px center no-repeat, -webkit-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
110
+ background: image-url('redditor/add_photo.png') 3px center no-repeat, -moz-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
111
+ background: image-url('redditor/add_photo.png') 3px center no-repeat, -o-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
112
+ background: image-url('redditor/add_photo.png') 3px center no-repeat, linear-gradient(to bottom, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
113
+ }
114
+ .redditor__add_slider {
115
+ background:#f5f5f5 image-url('redditor/add_slider.png') 3px center no-repeat;
116
+ background: image-url('redditor/add_slider.png') 3px center no-repeat, -webkit-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
117
+ background: image-url('redditor/add_slider.png') 3px center no-repeat, -moz-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
118
+ background: image-url('redditor/add_slider.png') 3px center no-repeat, -o-linear-gradient(top, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
119
+ background: image-url('redditor/add_slider.png') 3px center no-repeat, linear-gradient(to bottom, #fff 0%, #f5f5f5 49%, #ececec 50%, #eee 100%);
94
120
  }
121
+
95
122
  a.redactor_btn_format {
96
123
  background: image-url('redditor/no_format_text.png') center no-repeat !important;
97
124
  }
98
125
  a.redactor_btn_divide {
99
126
  background: image-url('redditor/destroy_block_text.png') center no-repeat !important;
100
127
  }
128
+
129
+ // стили для тестирования
101
130
  // dl.redditor dd:before {
102
131
  // content: "class: " attr(class); display: block; padding: 2px; background: #fcc;
103
132
  // }
@@ -6,7 +6,7 @@ class Redditor::Admin::PagesController < Redditor::Admin::BaseController
6
6
  def sort
7
7
  params[:sort].each do |k, v|
8
8
  v.each do |klass, info|
9
- klass.camelcase.constantize.find_by_id(info[:index]).update_attributes(position: info[:position]) rescue nil
9
+ "Redditor::#{klass.camelcase}".constantize.find_by_id(info[:index]).update_attributes(position: info[:position]) rescue nil
10
10
  end
11
11
  end
12
12
 
@@ -9,7 +9,7 @@ module Redditor
9
9
  content_tag(:dd, :id => "#{association.to_s.singularize}_#{id}") do
10
10
  tag(:div, class: "handle") +
11
11
  link_to("Удалить", "javascript:void(0);", onclick: "if (confirm('dfasdsa')) $(this).closest('dd').remove();") + "\s" +
12
- link_to("Обновить", [:admin, @article.page, association], method: "post", class: "update-data", remote: true, data: {disable_with: "Обновляется"}) + "\s" +
12
+ link_to("Обновить", [:admin, @article.page, association], method: "post", class: "redditor__update", remote: true, data: {disable_with: "Обновляется"}) + "\s" +
13
13
  render("admin/pages/" + association.to_s.singularize, f: builder)
14
14
  end
15
15
  end
@@ -1,16 +1,37 @@
1
1
  .handle
2
2
 
3
3
  - if content_block.new_record?
4
- .control-data
5
- = link_to "", "javascript:void(0);", onclick: "if (confirm('#{t "redditor.remove?"}')) $(this).closest('dd').remove();", class: "delete-data"
6
- = link_to "✔", [redditor, :admin, p.object, content_block], method: "post", class: "update-data", remote: true, data: {:disable_with => "✔ #{t "redditor.saving"}"}
4
+ .redditor__control
5
+ = link_to "",
6
+ "javascript:void(0);",
7
+ class: "redditor__delete",
8
+ onclick: "if (confirm('#{t "redditor.remove?"}')) $(this).closest('dd').remove();"
9
+
10
+ = link_to "",
11
+ [redditor, :admin, p.object, content_block],
12
+ method: "post",
13
+ class: "redditor__update",
14
+ remote: true,
15
+ data: {:disable_with => t("redditor.saving")}
16
+
7
17
  - else
8
- .control-data
9
- = link_to "", [redditor, :admin, p.object, content_block], :method => :delete, remote: true, data: {confirm: "Вы, действительно, хотите удалить контент-блок?", disable_with: "✘ #{t "redditor.deleting"}"}, class: "delete-data"
10
- = link_to "✔", [redditor, :admin, p.object, content_block], method: "put", class: "update-data", remote: true, data: {disable_with: "✔ #{t "redditor.saving"}"}
18
+ .redditor__control
19
+ = link_to "",
20
+ [redditor, :admin, p.object, content_block],
21
+ class: "redditor__delete",
22
+ :method => :delete,
23
+ remote: true,
24
+ data: {confirm: "Вы, действительно, хотите удалить контент-блок?", disable_with: t("redditor.deleting")}
25
+
26
+ = link_to "",
27
+ [redditor, :admin, p.object, content_block],
28
+ class: "redditor__update",
29
+ remote: true,
30
+ method: "put",
31
+ data: {disable_with: t("redditor.saving")}
11
32
 
12
33
  = p.fields_for content_block.class.name.underscore.sub('redditor/', '').pluralize.to_sym, content_block do |f|
13
34
  %div.form-name{data: {"object-name" => f.object.temp_id.present? ? f.object_name.sub!(/\[\d*\]/, "[#{f.object.temp_id}]") : f.object_name}, id: "#{content_block.class.name.underscore.sub(/\Aredditor\//, '')}_#{content_block.id.nil? ? f.object.temp_id : content_block.id}"}
14
- = f.text_field :position, class: 'js-position', hidden: true
35
+ = f.text_field :position, class: 'redditor__position', hidden: true
15
36
  = render :partial => "redditor/admin/pages/#{content_block.class.name.underscore.sub('redditor/', '')}", locals: {f: f}
16
37
  = f.hidden_field :temp_id
@@ -5,9 +5,9 @@
5
5
  - p.object.content_blocks.each do |content_block|
6
6
  = render partial: "redditor/admin/pages/content_block", locals: {p: p, page: p.object, content_block: content_block}, :layout => "redditor/admin/pages/wrap_dd"
7
7
 
8
- %div.redditor-add-blocks
8
+ %div.redditor__add-blocks
9
9
  %p
10
- = link_to t('redditor.add.text_block'), redditor.new_admin_page_text_block_path(f.object.page), remote: true, class: "new-block add-txt"
11
- = link_to t('redditor.add.video_block'), redditor.new_admin_page_video_block_path(f.object.page), remote: true, class: "new-block add-video"
12
- = link_to t('redditor.add.image_block'), redditor.new_admin_page_image_block_path(f.object.page), remote: true, class: "new-block add-photo"
13
- = link_to t('redditor.add.slider_block'), redditor.admin_page_slider_blocks_path(f.object.page), remote: true, method: 'POST', class: "new-block add-slider"
10
+ = link_to t('redditor.add.text_block'), redditor.new_admin_page_text_block_path(f.object.page), remote: true, class: "redditor__add redditor__add_txt"
11
+ = link_to t('redditor.add.video_block'), redditor.new_admin_page_video_block_path(f.object.page), remote: true, class: "redditor__add redditor__add_video"
12
+ = link_to t('redditor.add.image_block'), redditor.new_admin_page_image_block_path(f.object.page), remote: true, class: "redditor__add redditor__add_photo"
13
+ = link_to t('redditor.add.slider_block'), redditor.admin_page_slider_blocks_path(f.object.page), remote: true, method: 'POST', class: "redditor__add redditor__add_slider"
@@ -11,8 +11,8 @@ en:
11
11
  delete_image: "Delete image?"
12
12
  description: "Description"
13
13
  remove?: "Really delete content block?"
14
- deleting: Deleting...
15
- saving: Saving...
14
+ deleting: ' Deleting...'
15
+ saving: ' Saving...'
16
16
  title:
17
17
  image: Image
18
18
  video: Video
@@ -11,8 +11,8 @@ ru:
11
11
  delete_image: "Удалить изображение?"
12
12
  description: "Описание"
13
13
  remove?: "Вы, действительно, хотите удалить контент-блок?"
14
- deleting: Удаление...
15
- saving: Сохранение...
14
+ deleting: ' Удаление...'
15
+ saving: ' Сохранение...'
16
16
  title:
17
17
  image: Изображение
18
18
  video: Видео
@@ -1,3 +1,3 @@
1
1
  module Redditor
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -13,8 +13,8 @@ describe "Text block" do
13
13
  def visit_article() visit "/admin/articles/#{article.id}/edit"; end
14
14
  def add_block() find_link(I18n.t("redditor.add.text_block")).click; end
15
15
  def submit() find_button("Submit").click; end
16
- def save_block() find_link("").click; end
17
- def delete_block() find_link("").click; end
16
+ def save_block() find("a.redditor__update").click; end
17
+ def delete_block() find("a.redditor__delete").click; end
18
18
 
19
19
  it "Saves text block to article", type: :feature, js: true do
20
20
  add_block
@@ -26,12 +26,13 @@ describe "Text block" do
26
26
  it "Shows validation error if text block content is empty", type: :feature, js: true do
27
27
  add_block
28
28
  submit
29
- expect(page.find(".errors")).to have_content "can't be blank"
29
+ expect(page).to have_content "can't be blank"
30
30
  end
31
31
 
32
32
  it "Deletes text block", type: :feature, js: true do
33
33
  article.page.text_blocks.build(body: "123", position: 1).save
34
34
  visit_article
35
+ save_page
35
36
  delete_block
36
37
  visit_article
37
38
  text_value = begin
@@ -13,8 +13,8 @@ describe "Video block" do
13
13
  def visit_article() visit "/admin/articles/#{article.id}/edit"; end
14
14
  def add_block() find_link(I18n.t("redditor.add.video_block")).click; end
15
15
  def submit() find_button("Submit").click; end
16
- def save_block() find_link("").click; end
17
- def delete_block() find_link("").click; end
16
+ def save_block() find("a.redditor__update").click; end
17
+ def delete_block() find("a.redditor__delete").click; end
18
18
 
19
19
  it "Saves video block to article", type: :feature, js: true do
20
20
  add_block
data/spec/spec_helper.rb CHANGED
@@ -15,7 +15,7 @@ require 'capybara/rspec'
15
15
  require 'capybara/poltergeist'
16
16
 
17
17
  Capybara.javascript_driver = :poltergeist
18
- Capybara.default_wait_time = 10
18
+ # Capybara.default_wait_time = 10
19
19
 
20
20
  # Requires supporting ruby files with custom matchers and macros, etc,
21
21
  # in spec/support/ and its subdirectories.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Bovykin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-21 00:00:00.000000000 Z
12
+ date: 2013-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -251,20 +251,11 @@ files:
251
251
  - app/assets/images/redditor/move_handler.png
252
252
  - app/assets/images/redditor/no_format_text.png
253
253
  - app/assets/images/redditor/trash.png
254
- - app/assets/javascripts/fileapi/FileAPI.exif.js
255
- - app/assets/javascripts/fileapi/FileAPI.flash.image.swf
256
- - app/assets/javascripts/fileapi/FileAPI.flash.swf
257
- - app/assets/javascripts/fileapi/FileAPI.id3.js
258
- - app/assets/javascripts/fileapi/FileAPI.min.js
259
- - app/assets/javascripts/fileapi/fileapi.js.coffee.erb
260
- - app/assets/javascripts/fileapi/tmpl.js
261
254
  - app/assets/javascripts/fileapi/uploader.coffee
262
255
  - app/assets/javascripts/jquery-ui.min.js
263
256
  - app/assets/javascripts/redditor/application.js
264
257
  - app/assets/javascripts/redditor/redditor.coffee
265
258
  - app/assets/stylesheets/redditor/application.css.scss
266
- - app/assets/stylesheets/redditor/fileapi/fileapi.css.scss
267
- - app/assets/stylesheets/redditor/fileapi/fileapi_front.css.scss
268
259
  - app/assets/stylesheets/redditor/redditor.css.scss
269
260
  - app/controllers/redditor/admin/base_controller.rb
270
261
  - app/controllers/redditor/admin/image_blocks_controller.rb
@@ -286,7 +277,6 @@ files:
286
277
  - app/uploaders/redditor_uploader.rb
287
278
  - app/views/layouts/redditor/application.html.erb
288
279
  - app/views/redditor/admin/pages/_content_block.haml
289
- - app/views/redditor/admin/pages/_fileapi.erb
290
280
  - app/views/redditor/admin/pages/_image.haml
291
281
  - app/views/redditor/admin/pages/_page.haml
292
282
  - app/views/redditor/admin/pages/_slider_block.haml
@@ -1,59 +0,0 @@
1
- (function (){
2
- /**!
3
- * Binary Ajax 0.1.10
4
- * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
5
- * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
6
- *
7
- *
8
- * Javascript EXIF Reader 0.1.4
9
- * Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
10
- * Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
11
- */
12
-
13
-
14
- var BinaryFile=function(j,k,l){var h=j,i=k||0,b=0;this.getRawData=function(){return h};"string"==typeof j&&(b=l||h.length,this.getByteAt=function(a){return h.charCodeAt(a+i)&255},this.getBytesAt=function(a,b){for(var c=[],f=0;f<b;f++)c[f]=h.charCodeAt(a+f+i)&255;return c});this.getLength=function(){return b};this.getSByteAt=function(a){a=this.getByteAt(a);return 127<a?a-256:a};this.getShortAt=function(a,b){var c=b?(this.getByteAt(a)<<8)+this.getByteAt(a+1):(this.getByteAt(a+1)<<8)+this.getByteAt(a);
15
- 0>c&&(c+=65536);return c};this.getSShortAt=function(a,b){var c=this.getShortAt(a,b);return 32767<c?c-65536:c};this.getLongAt=function(a,b){var c=this.getByteAt(a),f=this.getByteAt(a+1),e=this.getByteAt(a+2),g=this.getByteAt(a+3),c=b?(((c<<8)+f<<8)+e<<8)+g:(((g<<8)+e<<8)+f<<8)+c;0>c&&(c+=4294967296);return c};this.getSLongAt=function(a,b){var c=this.getLongAt(a,b);return 2147483647<c?c-4294967296:c};this.getStringAt=function(a,b){for(var c=[],f=this.getBytesAt(a,b),e=0;e<b;e++)c[e]=String.fromCharCode(f[e]);
16
- return c.join("")};this.getCharAt=function(a){return String.fromCharCode(this.getByteAt(a))};this.toBase64=function(){return window.btoa(h)};this.fromBase64=function(a){h=window.atob(a)}},EXIF={};
17
- (function(){function j(b){if(255!=b.getByteAt(0)||216!=b.getByteAt(1))return!1;for(var a=2,d=b.getLength();a<d;){if(255!=b.getByteAt(a))return i&&console.log("Not a valid marker at offset "+a+", found: "+b.getByteAt(a)),!1;var c=b.getByteAt(a+1);if(22400==c||225==c)return i&&console.log("Found 0xFFE1 marker"),h(b,a+4,b.getShortAt(a+2,!0)-2);a+=2+b.getShortAt(a+2,!0)}}function k(b,a,d,c,f){for(var e=b.getShortAt(d,f),g={},h=0;h<e;h++){var j=d+12*h+2,k=c[b.getShortAt(j,f)];!k&&i&&console.log("Unknown tag: "+
18
- b.getShortAt(j,f));g[k]=l(b,j,a,d,f)}return g}function l(b,a,d,c,f){var e=b.getShortAt(a+2,f),c=b.getLongAt(a+4,f),d=b.getLongAt(a+8,f)+d;switch(e){case 1:case 7:if(1==c)return b.getByteAt(a+8,f);d=4<c?d:a+8;a=[];for(e=0;e<c;e++)a[e]=b.getByteAt(d+e);return a;case 2:return b.getStringAt(4<c?d:a+8,c-1);case 3:if(1==c)return b.getShortAt(a+8,f);d=2<c?d:a+8;a=[];for(e=0;e<c;e++)a[e]=b.getShortAt(d+2*e,f);return a;case 4:if(1==c)return b.getLongAt(a+8,f);a=[];for(e=0;e<c;e++)a[e]=b.getLongAt(d+4*e,f);
19
- return a;case 5:if(1==c)return b.getLongAt(d,f)/b.getLongAt(d+4,f);a=[];for(e=0;e<c;e++)a[e]=b.getLongAt(d+8*e,f)/b.getLongAt(d+4+8*e,f);return a;case 9:if(1==c)return b.getSLongAt(a+8,f);a=[];for(e=0;e<c;e++)a[e]=b.getSLongAt(d+4*e,f);return a;case 10:if(1==c)return b.getSLongAt(d,f)/b.getSLongAt(d+4,f);a=[];for(e=0;e<c;e++)a[e]=b.getSLongAt(d+8*e,f)/b.getSLongAt(d+4+8*e,f);return a}}function h(b,a){if("Exif"!=b.getStringAt(a,4))return i&&console.log("Not valid EXIF data! "+b.getStringAt(a,4)),!1;
20
- var d,c=a+6;if(18761==b.getShortAt(c))d=!1;else if(19789==b.getShortAt(c))d=!0;else return i&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;if(42!=b.getShortAt(c+2,d))return i&&console.log("Not valid TIFF data! (no 0x002A)"),!1;if(8!=b.getLongAt(c+4,d))return i&&console.log("Not valid TIFF data! (First offset not 8)",b.getShortAt(c+4,d)),!1;var f=k(b,c,c+8,EXIF.TiffTags,d);if(f.ExifIFDPointer){var e=k(b,c,c+f.ExifIFDPointer,EXIF.Tags,d),g;for(g in e){switch(g){case "LightSource":case "Flash":case "MeteringMode":case "ExposureProgram":case "SensingMethod":case "SceneCaptureType":case "SceneType":case "CustomRendered":case "WhiteBalance":case "GainControl":case "Contrast":case "Saturation":case "Sharpness":case "SubjectDistanceRange":case "FileSource":e[g]=
21
- EXIF.StringValues[g][e[g]];break;case "ExifVersion":case "FlashpixVersion":e[g]=String.fromCharCode(e[g][0],e[g][1],e[g][2],e[g][3]);break;case "ComponentsConfiguration":e[g]=EXIF.StringValues.Components[e[g][0]]+EXIF.StringValues.Components[e[g][1]]+EXIF.StringValues.Components[e[g][2]]+EXIF.StringValues.Components[e[g][3]]}f[g]=e[g]}}if(f.GPSInfoIFDPointer)for(g in d=k(b,c,c+f.GPSInfoIFDPointer,EXIF.GPSTags,d),d){switch(g){case "GPSVersionID":d[g]=d[g][0]+"."+d[g][1]+"."+d[g][2]+"."+d[g][3]}f[g]=
22
- d[g]}return f}var i=!1;EXIF.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",
23
- 34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",
24
- 41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"};EXIF.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",
25
- 259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",
26
- 272:"Model",305:"Software",315:"Artist",33432:"Copyright"};EXIF.GPSTags={"0":"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",
27
- 24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"};EXIF.StringValues={ExposureProgram:{"0":"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{"0":"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{"0":"Unknown",
28
- 1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{"0":"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",
29
- 7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",
30
- 71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},
31
- SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{"0":"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{"0":"Normal process",1:"Custom process"},WhiteBalance:{"0":"Auto white balance",1:"Manual white balance"},GainControl:{"0":"None",1:"Low gain up",2:"High gain up",
32
- 3:"Low gain down",4:"High gain down"},Contrast:{"0":"Normal",1:"Soft",2:"Hard"},Saturation:{"0":"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{"0":"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{"0":"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{"0":"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};EXIF.getData=function(b,a){if(!b.complete)return!1;b.exifdata?a&&a():BinaryAjax(b.src,function(d){d=j(d.binaryResponse);b.exifdata=d||{};a&&a()});return!0};
33
- EXIF.getTag=function(b,a){if(b.exifdata)return b.exifdata[a]};EXIF.getAllTags=function(b){if(!b.exifdata)return{};var b=b.exifdata,a={},d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a};EXIF.pretty=function(b){if(!b.exifdata)return"";var b=b.exifdata,a="",d;for(d in b)b.hasOwnProperty(d)&&(a="object"==typeof b[d]?a+(d+" : ["+b[d].length+" values]\r\n"):a+(d+" : "+b[d]+"\r\n"));return a};EXIF.readFromBinaryFile=function(b){return j(b)}})();
34
-
35
-
36
- FileAPI.support.exif = true;
37
-
38
-
39
- FileAPI.addInfoReader(/^image/, function (file/**File*/, callback/**Function*/){
40
- if( !file.__exif ){
41
- var defer = file.__exif = FileAPI.defer();
42
-
43
- FileAPI.readAsBinaryString(file, function (evt){
44
- if( evt.type == 'load' ){
45
- var binaryString = evt.result;
46
- var oFile = new BinaryFile(binaryString, 0, file.size);
47
- var exif = EXIF.readFromBinaryFile(oFile);
48
-
49
- defer.resolve(false, { 'exif': exif || {} });
50
- }
51
- else if( evt.type == 'error' ){
52
- defer.resolve('read_as_binary_string_exif');
53
- }
54
- });
55
- }
56
-
57
- file.__exif.then(callback);
58
- });
59
- })();