bhf 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,6 +35,7 @@ class Bhf::EntriesController < Bhf::ApplicationController
35
35
  if @quick_edit
36
36
  render json: object_to_bhf_display_hash, status: :ok
37
37
  else
38
+ redirect_to params[:link_back] and return if params[:link_back]
38
39
  redirect_back_or_default(bhf_entry_path(@platform.name, @object), notice: set_message('update.success', @model))
39
40
  end
40
41
  else
@@ -0,0 +1,5 @@
1
+ = node f, field do
2
+ .location_map_holder
3
+ = f.hidden_field :lat, :'data-default-lat' => 42.6259285, class: 'map_data_lat'
4
+ = f.hidden_field :lng, :'data-default-lng' => -70.6519888, class: 'map_data_lng'
5
+ = javascript_include_tag 'http://maps.googleapis.com/maps/api/js?sensor=false'
@@ -1,2 +1,2 @@
1
1
  = node f, field do
2
- = f.text_area field.name, class: ('markdown' unless @quick_edit)
2
+ = f.text_area field.name, class: ('wmd_editor' unless @quick_edit)
@@ -1,4 +1,4 @@
1
- .node{class: field.display_type}
1
+ .node{class: field.form_type}
2
2
  .label= f.label field.name
3
3
  .input
4
4
  = input
@@ -52,4 +52,4 @@
52
52
  = link_to new_t(platform), new_bhf_entry_path(platform.name)
53
53
 
54
54
  - if platform.custom_partial
55
- = render partial: "bhf/pages/#{platform.custom_partial}", locals: {}
55
+ = render partial: "bhf/pages/#{platform.custom_partial}"
@@ -23,8 +23,8 @@ module Kaminari
23
23
  end
24
24
  end
25
25
  end
26
- # TODO: lets hope they fix nested params and we can remove this
27
- # https://github.com/amatsuda/kaminari/issues/145
26
+ # TODO: lets hope they'll fix nested params and we can remove this
27
+ # https://github.com/amatsuda/kaminari/issues/152
28
28
 
29
29
 
30
30
  module Bhf
@@ -2,7 +2,7 @@ module Bhf
2
2
  module ViewHelpers
3
3
  module ActionView
4
4
 
5
- def bhf_edit(object, options = {}) # TODO: block of html for custom editing buttons and links
5
+ def bhf_edit(object, options = {}) # TODO: add a block of html for custom editing buttons and links
6
6
  return unless session[Bhf::Engine.config.session_auth_name.to_s] == true
7
7
 
8
8
  options[:platform_name] ||= object.class.to_s.pluralize.downcase
@@ -56,7 +56,7 @@ window.addEvent('domready', function(){
56
56
  }, options));
57
57
  });
58
58
 
59
- scope.getElements('.markdown').each(function(mdTa){
59
+ scope.getElements('.wmd_editor').each(function(mdTa){
60
60
  var headline, toggleHtmlPreview, toggleLivePreview, livePreview, htmlPreview;
61
61
 
62
62
  var togglePreview = function(e){
@@ -91,6 +91,10 @@ window.addEvent('domready', function(){
91
91
  autoFormatting: false
92
92
  });
93
93
  });
94
+
95
+ scope.getElements('.map_data_lat').each(function(lat){
96
+ new Latlng(lat);
97
+ });
94
98
  };
95
99
 
96
100
  // TODO: disable more ajax calls while ajax is loading
@@ -143,6 +147,7 @@ window.addEvent('domready', function(){
143
147
  url: href,
144
148
  onSuccess: function(a, b, html){
145
149
  platform.innerHTML = html;
150
+ rails.applyEvents(platform);
146
151
  if (callback) {
147
152
  callback.call();
148
153
  }
@@ -0,0 +1,64 @@
1
+ var Latlng = new Class({
2
+ Implements: [Options, Events],
3
+
4
+ options: {
5
+ },
6
+
7
+ initialize: function(elem){
8
+ var latElem = elem;
9
+ var lngElem = elem.getNext('.map_data_lng');
10
+ var setValues = function(lat, lng){
11
+ latElem.value = lat;
12
+ lngElem.value = lng;
13
+ };
14
+
15
+ var center = new google.maps.LatLng(
16
+ latElem.value ? latElem.value : latElem.get('data-default-lat'),
17
+ lngElem.value ? lngElem.value : latElem.get('data-default-lng')
18
+ );
19
+
20
+ var map = new google.maps.Map(new Element('div.map_canvas').inject(latElem, 'before'), {
21
+ zoom: 14,
22
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
23
+ center: center,
24
+ mapTypeControl: true,
25
+ zoomControl: true,
26
+ zoomControlOptions: {
27
+ style: google.maps.ZoomControlStyle.SMALL
28
+ },
29
+ streetViewControl: false,
30
+ panControl: false,
31
+ scaleControl: false,
32
+ overviewMapControl: false
33
+ });
34
+
35
+ var marker = new google.maps.Marker({
36
+ title: 'Location',
37
+ draggable: true
38
+ });
39
+
40
+ if (latElem.value && lngElem.value) {
41
+ marker.position = new google.maps.LatLng(latElem.value, lngElem.value);
42
+ marker.setMap(map);
43
+ }
44
+ else {
45
+ if (navigator) {
46
+ navigator.geolocation.getCurrentPosition(function(e){
47
+ map.setCenter(new google.maps.LatLng(e.coords.latitude, e.coords.longitude));
48
+ });
49
+ }
50
+ google.maps.event.addListener(map, 'click', function(e){
51
+ marker.position = e.latLng;
52
+ marker.setMap(map);
53
+ setValues(marker.getPosition().Ka, marker.getPosition().La);
54
+ google.maps.event.clearListeners(map, 'click');
55
+ });
56
+ }
57
+
58
+ google.maps.event.addListener(marker, 'dragend', function(){
59
+ var mPos = marker.getPosition();
60
+ map.panTo(mPos);
61
+ setValues(mPos.Sa, mPos.Ta);
62
+ });
63
+ }
64
+ });
@@ -664,6 +664,14 @@ input[type="submit"].alt_button,
664
664
  display: none
665
665
 
666
666
 
667
+ .location_map_holder
668
+ .map_canvas
669
+ @extend .default_input
670
+ margin-left: -6px
671
+ height: 350px
672
+ width: 500px
673
+
674
+
667
675
  // MooEditable
668
676
 
669
677
  @import MooEditable
@@ -685,8 +693,6 @@ input[type="submit"].alt_button,
685
693
  background: $g2 !important
686
694
 
687
695
 
688
- // Datepicker TODO: style div.datepicker
689
-
690
696
  .datepicker
691
697
  position: absolute
692
698
  width: 172px
@@ -938,7 +944,7 @@ input[type="submit"].alt_button,
938
944
  @extend .default_input
939
945
  margin-left: -6px
940
946
  margin-bottom: 5px
941
- #main .markdown
947
+ #main .wmd_editor
942
948
  height: 400px
943
949
  width: 700px
944
950
 
@@ -977,8 +983,6 @@ input[type="submit"].alt_button,
977
983
  display: inline-block
978
984
  list-style: none
979
985
 
980
- // TODO: style this properly
981
-
982
986
  .wmd-button-row
983
987
  .wmd-bold-button
984
988
  background-position: 0px 0px
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bhf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-01 00:00:00.000000000Z
12
+ date: 2012-02-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70212146198000 !ruby/object:Gem::Requirement
16
+ requirement: &70148313739300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70212146198000
24
+ version_requirements: *70148313739300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: kaminari
27
- requirement: &70212146194680 !ruby/object:Gem::Requirement
27
+ requirement: &70148313738740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.12.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70212146194680
35
+ version_requirements: *70148313738740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: haml-rails
38
- requirement: &70212146193480 !ruby/object:Gem::Requirement
38
+ requirement: &70148313738260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.3.4
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70212146193480
46
+ version_requirements: *70148313738260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sass-rails
49
- requirement: &70212146192520 !ruby/object:Gem::Requirement
49
+ requirement: &70148313737760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 3.1.4
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70212146192520
57
+ version_requirements: *70148313737760
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mootools-rails
60
- requirement: &70212146185500 !ruby/object:Gem::Requirement
60
+ requirement: &70148313737200 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0.4'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70212146185500
68
+ version_requirements: *70148313737200
69
69
  description: Gets you there on time
70
70
  email: anton.pawlik@gmail.com
71
71
  executables: []
@@ -94,6 +94,7 @@ files:
94
94
  - app/views/bhf/entries/form/column/_boolean.haml
95
95
  - app/views/bhf/entries/form/column/_date.haml
96
96
  - app/views/bhf/entries/form/column/_file.haml
97
+ - app/views/bhf/entries/form/column/_mappin.haml
97
98
  - app/views/bhf/entries/form/column/_markdown.haml
98
99
  - app/views/bhf/entries/form/column/_multiple_fields.haml
99
100
  - app/views/bhf/entries/form/column/_number.haml
@@ -169,6 +170,7 @@ files:
169
170
  - vendor/assets/javascripts/bhf/classes/Ajaxify.js
170
171
  - vendor/assets/javascripts/bhf/classes/ArrayFields.js
171
172
  - vendor/assets/javascripts/bhf/classes/BrowserUpdate.js
173
+ - vendor/assets/javascripts/bhf/classes/Latlng.js
172
174
  - vendor/assets/javascripts/bhf/classes/Locale.de-DE.DatePicker.js
173
175
  - vendor/assets/javascripts/bhf/classes/Locale.en-US.DatePicker.js
174
176
  - vendor/assets/javascripts/bhf/classes/MooEditable.js