app/helpers/application_helper.rb
# Inserts a simple text field that let users edit given property (text property).
Inserts a simple text field that let users edit given property (text property).
Inserts a simple text field that let users edit given property ( text property ) .
def editable_field (object, property, options={})
    update_url = options.delete(:update_url) || url_for(object)
    id = "text-editor-#{property}-#{object.class.to_s.underscore}-#{object.id}"
    prop_name = "#{object.class.to_s.underscore}[#{property}]"
    value = object.send(property)
    %{
      <span id="#{id}"></span>
      <script type="text/javascript">
        (function() {
          var props = {
            data: {
              "#{prop_name}": #{value.to_json}
            },
            updateUrl: "#{update_url}",
            propName: "#{prop_name}",
            placeholder: "#{options[:placeholder]}"
          };
          EditableField = React.createElement(modulejs.require('components/authoring/editable_field'), props);
          ReactDOM.render(EditableField, $("##{id}")[0]);
        }());
      </script>
    }.html_safe
  end
def editable_field ( object , property , options = { } ) update_url = options . delete ( :update_url ) || url_for ( object ) id = "text-editor-#{property}-#{object.class.to_s.underscore}-#{object.id}" prop_name = "#{object.class.to_s.underscore}[#{property}]" value = object . send ( property ) %{
      <span id="#{id}"></span>
      <script type="text/javascript">
        (function() {
          var props = {
            data: {
              "#{prop_name}": #{value.to_json}
            },
            updateUrl: "#{update_url}",
            propName: "#{prop_name}",
            placeholder: "#{options[:placeholder]}"
          };
          EditableField = React.createElement(modulejs.require('components/authoring/editable_field'), props);
          ReactDOM.render(EditableField, $("##{id}")[0]);
        }());
      </script>
    } . html_safe end
Inserts a simple text field that let users edit given property (text property).
Inserts a simple text field that let users edit given property ( text property ) .
object
<not_specific>
property
<not_specific>
options
<not_specific>