hallo_rails 0.0.4 → 0.0.5
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.
- data/lib/hallo_rails/version.rb +1 -1
 - data/lib/hallo_rails.rb +1 -1
 - data/vendor/assets/javascripts/hallo_rails.js.coffee +26 -26
 - metadata +3 -3
 
    
        data/lib/hallo_rails/version.rb
    CHANGED
    
    
    
        data/lib/hallo_rails.rb
    CHANGED
    
    | 
         @@ -20,7 +20,7 @@ module HalloRails 
     | 
|
| 
       20 
20 
     | 
    
         
             
                  object_name = object.class.to_s.underscore
         
     | 
| 
       21 
21 
     | 
    
         
             
                  options.reverse_merge! tag: :div,
         
     | 
| 
       22 
22 
     | 
    
         
             
                                         content: object.send(method).try(:html_safe),
         
     | 
| 
       23 
     | 
    
         
            -
                                         update_url: " 
     | 
| 
      
 23 
     | 
    
         
            +
                                         update_url: "/#{object_name.pluralize}/#{object.to_param}",
         
     | 
| 
       24 
24 
     | 
    
         
             
                                         blank_text: "<i>Click to Edit</i>".html_safe
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
                  content_tag options[:tag], options[:content].present? ? options[:content] : options[:blank_text],
         
     | 
| 
         @@ -19,32 +19,32 @@ init = -> 
     | 
|
| 
       19 
19 
     | 
    
         
             
                $.extend options, { plugins: plugins }
         
     | 
| 
       20 
20 
     | 
    
         
             
                $el.hallo options
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
              $('body').on "hallodeactivated", '.editable', ->
         
     | 
| 
      
 23 
     | 
    
         
            +
                $el = $(this)
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                data = {}
         
     | 
| 
      
 26 
     | 
    
         
            +
                method_data = {}
         
     | 
| 
      
 27 
     | 
    
         
            +
                method_data[$el.data('method')] = $el.html()
         
     | 
| 
      
 28 
     | 
    
         
            +
                data[ $el.data('model') ] = method_data
         
     | 
| 
      
 29 
     | 
    
         
            +
                for property_name of $el.data()
         
     | 
| 
      
 30 
     | 
    
         
            +
                  if typeof $el.data(property_name) == 'string' and property_name != 'method' and
         
     | 
| 
      
 31 
     | 
    
         
            +
                   property_name != 'model' and property_name != 'updateUrl'
         
     | 
| 
      
 32 
     | 
    
         
            +
                    data[property_name] = $el.data(property_name)
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                $.ajax
         
     | 
| 
      
 35 
     | 
    
         
            +
                  url: $el.data('update-url')
         
     | 
| 
      
 36 
     | 
    
         
            +
                  type: 'PUT'
         
     | 
| 
      
 37 
     | 
    
         
            +
                  data: data
         
     | 
| 
      
 38 
     | 
    
         
            +
                  beforeSend: ->
         
     | 
| 
      
 39 
     | 
    
         
            +
                    $el.addClass('hallo_updating')
         
     | 
| 
      
 40 
     | 
    
         
            +
                  success: ->
         
     | 
| 
      
 41 
     | 
    
         
            +
                    $el.removeClass('hallo_updating')
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              $('body').on "hallodeactivated", '.form_editable', ->
         
     | 
| 
      
 44 
     | 
    
         
            +
                $el = $(this)
         
     | 
| 
      
 45 
     | 
    
         
            +
                hidden_textarea_name = "#{$el.data('model')}[#{$el.data('method')}]"
         
     | 
| 
      
 46 
     | 
    
         
            +
                $hidden_textarea = $el.next("textarea[name='#{hidden_textarea_name}']")
         
     | 
| 
      
 47 
     | 
    
         
            +
                $hidden_textarea.html $el.html()
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
49 
     | 
    
         
             
            @HalloRails = { default_options, default_plugins, init }
         
     | 
| 
       50 
50 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hallo_rails
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.5
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -59,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       59 
59 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       60 
60 
     | 
    
         
             
                  segments:
         
     | 
| 
       61 
61 
     | 
    
         
             
                  - 0
         
     | 
| 
       62 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 62 
     | 
    
         
            +
                  hash: -584789263880855248
         
     | 
| 
       63 
63 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       64 
64 
     | 
    
         
             
              none: false
         
     | 
| 
       65 
65 
     | 
    
         
             
              requirements:
         
     | 
| 
         @@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       68 
68 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       69 
69 
     | 
    
         
             
                  segments:
         
     | 
| 
       70 
70 
     | 
    
         
             
                  - 0
         
     | 
| 
       71 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 71 
     | 
    
         
            +
                  hash: -584789263880855248
         
     | 
| 
       72 
72 
     | 
    
         
             
            requirements: []
         
     | 
| 
       73 
73 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       74 
74 
     | 
    
         
             
            rubygems_version: 1.8.24
         
     |