bhf 0.9.4 → 0.9.5

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: f344e5b10c973d0d42c55159deb54c645e7a0e24
4
- data.tar.gz: 1091824278485c4d3be0c94fdde0269dbabf1184
3
+ metadata.gz: efd84f0c58a39fc43e2aa2fe6a253335a8dce56b
4
+ data.tar.gz: 4b64fe048aaa0a67edd554e25f5bbe5c49178e68
5
5
  SHA512:
6
- metadata.gz: 31617fbd1004836e2045abf8e26195a593a2e63d0d28c38616ae5be813022e7179fd4de6dada51fb8f65f56ff6f36f774f51fecb5c33a96caa6631cda2e7ef00
7
- data.tar.gz: 74cb8070bb915bc29a02893125ac3c9c23db534e1a6d6190f7b526282139602c6eddf9effc2474452406ea0617e3ad1b3c814a6b94ef5de1d742bec34bee4e10
6
+ metadata.gz: c836650024dec75f04624a7014b5c1762621e5f1f3b999b98291cc40fa4ea9d27fb3aa0603499508d5cfe2d54849d501dae1c2f6cf9373d744ab9b20eca5d533
7
+ data.tar.gz: 5ecfd72626e8ea55cbfba02fe689d4a57f0528607c8043810004af929259d2232fcdf780a722293d6b1b21142012e5448ecaf9c4a518b59342cba5259d9f3f0e
data/Gemfile.lock CHANGED
@@ -33,13 +33,13 @@ GEM
33
33
  coffee-rails (4.0.1)
34
34
  coffee-script (>= 2.2.0)
35
35
  railties (>= 4.0.0, < 5.0)
36
- coffee-script (2.2.0)
36
+ coffee-script (2.3.0)
37
37
  coffee-script-source
38
38
  execjs
39
- coffee-script-source (1.7.0)
39
+ coffee-script-source (1.7.1)
40
40
  descendants_tracker (0.0.4)
41
41
  thread_safe (~> 0.3, >= 0.3.1)
42
- docile (1.1.4)
42
+ docile (1.1.5)
43
43
  erubis (2.7.0)
44
44
  execjs (2.2.1)
45
45
  faraday (0.9.0)
@@ -60,10 +60,10 @@ GEM
60
60
  activesupport (>= 4.0.1)
61
61
  haml (>= 3.1, < 5.0)
62
62
  railties (>= 4.0.1)
63
- hashie (3.1.0)
63
+ hashie (3.2.0)
64
64
  highline (1.6.21)
65
65
  hike (1.2.3)
66
- i18n (0.6.9)
66
+ i18n (0.6.11)
67
67
  jeweler (2.0.1)
68
68
  builder
69
69
  bundler (>= 1.0)
@@ -89,7 +89,7 @@ GEM
89
89
  multipart-post (2.0.0)
90
90
  nokogiri (1.6.2.1)
91
91
  mini_portile (= 0.6.0)
92
- oauth2 (0.9.4)
92
+ oauth2 (1.0.0)
93
93
  faraday (>= 0.8, < 0.10)
94
94
  jwt (~> 1.0)
95
95
  multi_json (~> 1.3)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.4
1
+ 0.9.5
@@ -9,9 +9,8 @@
9
9
  Turbolinks.pagesCached(0);
10
10
 
11
11
  (function(){
12
- var stackIndexCounter = 0;
13
12
  var lang = document.html.get('lang').split('-')[0];
14
- lang = (lang === 'en') ? 'en-US' : lang.toLowerCase()+'-'+lang.toUpperCase()
13
+ lang = (lang === 'en') ? 'en-US' : lang.toLowerCase()+'-'+lang.toUpperCase();
15
14
  Locale.use(lang);
16
15
 
17
16
  var ajaxNote = new Ajaxify();
@@ -70,12 +69,13 @@ Turbolinks.pagesCached(0);
70
69
  var newEntryInjectArea = parent.getElement('.quick_edit_inject');
71
70
  var relation = parent.getElement('.relation');
72
71
  var entry = linkElem.getParent('.quick_edit_entry');
72
+ var parsedTemplate;
73
73
  if ( ! entry) {
74
74
  entry = parent.getElement('.quick_edit_active');
75
75
  }
76
76
 
77
77
  if (json) {
78
- var parsedTemplate = entryTemplate.innerHTML.replace(new RegExp('%7Bobject_id%7D', 'g'), '{object_id}').substitute(json)
78
+ parsedTemplate = entryTemplate.innerHTML.replace(new RegExp('%7Bobject_id%7D', 'g'), '{object_id}').substitute(json);
79
79
  }
80
80
 
81
81
  if (eventNames.contains('successAndAdd')) {
@@ -110,6 +110,17 @@ Turbolinks.pagesCached(0);
110
110
 
111
111
  }
112
112
  };
113
+
114
+ var scrollContent = function(){
115
+ editStack.bricksArray.each(function(quickEdit){
116
+ var innerForm = quickEdit.holder.getElement('form');
117
+ if ( ! innerForm) { return; }
118
+ var scroll = document.body.scrollTop - 83;
119
+ if (scroll + innerForm.getSize().y > document.body.clientHeight) { return; }
120
+ quickEdit.holder.setStyle('padding-top', scroll);
121
+ });
122
+ };
123
+
113
124
 
114
125
  window.addEvent('bhfDomChunkReady', function(mainScope){
115
126
 
@@ -133,10 +144,10 @@ Turbolinks.pagesCached(0);
133
144
  onFailure: function(){
134
145
  ajaxNote.failure();
135
146
  },
136
- onStartRequest: function(form){
147
+ onStartRequest: function(){
137
148
  ajaxNote.loading();
138
149
  },
139
- onFormInjected: function(form){
150
+ onFormInjected: function(){
140
151
  scrollContent();
141
152
  ajaxNote.success();
142
153
  },
@@ -155,7 +166,7 @@ Turbolinks.pagesCached(0);
155
166
  var platforms = mainScope.getElements('.platform');
156
167
  var mainForm = mainScope.getElementById('main_form');
157
168
 
158
- mainScope.getElements('.quick_edit_select').addEvent('change', function(e){
169
+ mainScope.getElements('.quick_edit_select').addEvent('change', function(){
159
170
  var parent = this.getParent('.quick_edit_block');
160
171
  var optionElem = this.options[this.selectedIndex];
161
172
  var editElem = parent.getElement('.js_edit_field');
@@ -178,10 +189,10 @@ Turbolinks.pagesCached(0);
178
189
 
179
190
  mainScope.addEvent('click:relay(.js_delete)', function(e){
180
191
  e.target.addEvents({
181
- 'ajax:success': function(html){
192
+ 'ajax:success': function(){
182
193
  updateElementsAfterQuickEditSuccess(['successAndRemove'], e.target);
183
194
  },
184
- 'ajax:failure': function(html){
195
+ 'ajax:failure': function(){
185
196
  alert(Locale.get('Notifications.failure'));
186
197
  }
187
198
  });
@@ -190,9 +201,8 @@ Turbolinks.pagesCached(0);
190
201
 
191
202
  if (platforms.length) {
192
203
  quickEditOptions = Object.merge({
193
- onSuccessAndNext: function(json){
204
+ onSuccessAndNext: function(){
194
205
  var tr = this.linkElem;
195
- var qe;
196
206
  var nextTr = tr.getNext('tr');
197
207
 
198
208
  if (nextTr) {
@@ -200,6 +210,7 @@ Turbolinks.pagesCached(0);
200
210
  editStack.addEditBrick(quickEditOptions, nextTr.getElement('a'), nextTr);
201
211
  }
202
212
  else {
213
+ var trIndex;
203
214
  var platform = tr.getParent('.platform');
204
215
  var loadMore = platform.getElement('.load_more');
205
216
  if (loadMore) {
@@ -250,7 +261,7 @@ Turbolinks.pagesCached(0);
250
261
  }
251
262
  else if (mainForm) {
252
263
  quickEditOptions = Object.merge({
253
- onSuccessAndNext: function(json){
264
+ onSuccessAndNext: function(){
254
265
  var a = this.linkElem;
255
266
  var li = a.getParent('li');
256
267
  if ( ! li) {
@@ -288,20 +299,10 @@ Turbolinks.pagesCached(0);
288
299
  });
289
300
  }
290
301
 
291
- var scrollContent = function(){
292
- editStack.bricksArray.each(function(quickEdit){
293
- var innerForm = quickEdit.holder.getElement('form');
294
- if ( ! innerForm) { return; }
295
- var scroll = document.body.scrollTop - 83;
296
- if (scroll + innerForm.getSize().y > document.body.clientHeight) { return; }
297
- quickEdit.holder.setStyle('padding-top', scroll);
298
- });
299
- };
300
-
301
302
  mainScope.getElements('.js_sortable').each(function(sortableElems){
302
303
  new Sortables(sortableElems, {
303
304
  handle: '.handle',
304
- onStart: function(element, clone){
305
+ onStart: function(element){
305
306
  element.addClass('dragged');
306
307
  },
307
308
  onComplete: function(element){
@@ -333,7 +334,7 @@ Turbolinks.pagesCached(0);
333
334
  var parent = this.getParent();
334
335
  var newText = parent.get('data-empty-field-text');
335
336
  if (this.value) {
336
- newText = text.getLast() || this.value;
337
+ newText = text.getLast() || this.value;
337
338
  }
338
339
  parent.getElement('.h_text').set('text', newText);
339
340
  });
@@ -356,4 +357,4 @@ Turbolinks.pagesCached(0);
356
357
  window.addEvent('domready', bodyCallback);
357
358
  window.addEvent('platformUpdate', scopeCallback);
358
359
  window.addEvent('quickEditFormInject', scopeCallback);
359
- })();
360
+ }());
@@ -474,7 +474,9 @@ table.data_table
474
474
 
475
475
  .quick_edit_holder
476
476
  .error_explanation
477
- margin-left: 0
477
+ margin-top: -10px
478
+ margin-left: -20px
479
+ margin-right: -20px
478
480
 
479
481
  form
480
482
  .node
@@ -607,13 +609,25 @@ form
607
609
  text-decoration: underline
608
610
 
609
611
  .error_explanation
610
- margin-left: 20px
612
+ h5
613
+ padding: 10px 20px
614
+ background: $r1
615
+ color: $w1
616
+ font-weight: normal
617
+ ul
618
+ padding: 5px 20px
619
+ background: $w1
620
+ list-style: square
621
+ li
622
+ margin: 0 20px
623
+ padding: 5px 0
624
+ color: $r1
611
625
  label
612
- color: $r1
626
+ color: $k1
613
627
  cursor: pointer
614
628
  display: block
615
629
  &:hover
616
- color: $orange
630
+ color: $r1
617
631
 
618
632
  .qe_button
619
633
  text-decoration: none
@@ -34,7 +34,7 @@ class Bhf::ApplicationController < ActionController::Base
34
34
 
35
35
  def get_account_roles(area = nil)
36
36
  return unless current_account
37
-
37
+
38
38
  if area
39
39
  if current_account.respond_to?(:bhf_area_roles)
40
40
  return current_account.bhf_area_roles(area).collect(&:identifier)
@@ -53,7 +53,7 @@ class Bhf::ApplicationController < ActionController::Base
53
53
 
54
54
  def set_title
55
55
  @app_title = Rails.application.class.to_s.split('::').first
56
-
56
+
57
57
  @title = if params[:bhf_area]
58
58
  t("bhf.areas.page_title.#{params[:bhf_area]}",
59
59
  area: params[:bhf_area],
@@ -85,14 +85,13 @@ class Bhf::ApplicationController < ActionController::Base
85
85
 
86
86
  def set_message(type, model = nil)
87
87
  key = model && ActiveModel::Naming.singular(model)
88
-
89
88
  I18n.t("bhf.activerecord.notices.models.#{key}.#{type}", model: model.model_name.human, default: I18n.t("activerecord.notices.messages.#{type}"))
90
89
  end
91
90
 
92
91
  def init_time
93
92
  @start_time = Time.now
94
93
  end
95
-
94
+
96
95
  def find_platform(platform_name)
97
96
  Bhf::Platform::Base.new(@settings.find_platform_settings(platform_name))
98
97
  end
@@ -5,7 +5,7 @@
5
5
  - if file.file?
6
6
 
7
7
  - if type_is_image?(file.content_type)
8
- = image_tag find_smallest_size_url_for_file(file), class: 'uploaded_image'
8
+ = link_to image_tag(find_smallest_size_url_for_file(file), class: 'uploaded_image'), file.url
9
9
  - else
10
10
  = link_to file.original_filename, file.url, class: 'uploaded_file'
11
11
 
data/bhf.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bhf 0.9.4 ruby lib
5
+ # stub: bhf 0.9.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bhf"
9
- s.version = "0.9.4"
9
+ s.version = "0.9.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Anton Pawlik"]
14
- s.date = "2014-07-12"
14
+ s.date = "2014-07-14"
15
15
  s.description = "A simple to use Rails-Engine-Gem that offers an admin interface for trusted user. Easy integratable and highly configurable and agnostic. Works with ActiveRecord and Mongoid."
16
16
  s.email = "anton.pawlik@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -1,14 +1,13 @@
1
1
  module Bhf::Settings
2
2
 
3
3
  class YAMLParser
4
-
4
+
5
5
  attr_accessor :settings_hash
6
-
6
+
7
7
  def initialize(roles_array, area = nil)
8
8
  roles_settings = roles_yml(roles_array, area)
9
9
 
10
10
  if Bhf.configuration.abstract_settings.any?
11
-
12
11
  tmp_pages = get_settings_array(Bhf.configuration.abstract_settings)['pages']
13
12
  abstract_platform_settings = tmp_pages.each_with_object({}) do |abstract_pages, hash|
14
13
  abstract_pages.each do |abstract_page|
@@ -17,7 +16,7 @@ module Bhf::Settings
17
16
  end
18
17
  end
19
18
  end
20
-
19
+
21
20
  roles_settings['pages'].each_with_index do |pages, i_1|
22
21
  pages.each_pair do |key_1, page|
23
22
  page.each_with_index do |platform, i_2|
@@ -34,15 +33,25 @@ module Bhf::Settings
34
33
  end
35
34
  end
36
35
  end
37
-
36
+
38
37
  @settings_hash = roles_settings
39
38
  end
40
39
 
41
-
42
40
  def get_settings_array(array, dir = nil)
43
- array.each_with_object({'pages' => []}) do |r, account_roles|
44
- pages = load_yml("#{dir}/#{r}")['pages']
45
- account_roles['pages'] += pages if pages
41
+ array.each_with_object({'pages' => []}) do |file_name, tmp_settings_hash|
42
+ absolut_path = false
43
+ file_path = if dir
44
+ "#{dir}/#{file_name}"
45
+ else
46
+ if file_name[0,1] == '/'
47
+ absolut_path = true
48
+ file_name
49
+ else
50
+ "/#{file_name}"
51
+ end
52
+ end
53
+ pages = load_yml(file_path, absolut_path)['pages']
54
+ tmp_settings_hash['pages'] += pages if pages
46
55
  end
47
56
  end
48
57
 
@@ -63,7 +72,7 @@ module Bhf::Settings
63
72
  end
64
73
  end
65
74
  end
66
- if !merged
75
+ unless merged
67
76
  merged_files['pages'] << pages
68
77
  end
69
78
  end
@@ -73,10 +82,15 @@ module Bhf::Settings
73
82
  end
74
83
  end
75
84
 
76
- def load_yml(suffix = nil)
77
- YAML::load(IO.read("config/bhf#{suffix}.yml"))
85
+ def load_yml(suffix = nil, absolut_path = false)
86
+ file_path = if absolut_path
87
+ "#{suffix}.yml"
88
+ else
89
+ "config/bhf#{suffix}.yml"
90
+ end
91
+ YAML::load(IO.read(file_path))
78
92
  end
79
-
93
+
80
94
  end
81
95
 
82
96
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bhf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Pawlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-12 00:00:00.000000000 Z
11
+ date: 2014-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails