cirandas.net

ref: dockerize

plugins/exchange/views/exchange_plugin_element/_view.html.erb


<% type = element.object_type.gsub('::', '').underscore %>

  • <% if element.object.respond_to? :image and element.object.image.present? %>
    <% end %>
    <% if element.proposal.open? %>
    <%= _('Qty') %>
    <%= text_field_tag "quantity", element.quantity, class: "exchange-qty-input", onblur: "exchange.updateField(this, '#{url_for controller: :exchange_plugin_element, action: :edit, id: element.id}', {element: {quantity: this.value}});" %>
    <%= link_to_remote '', url: {controller: :exchange_plugin_element, action: :destroy, id: element.id, actor: actor, object_type: element.object_type} %>
    <% else %> <% if element.quantity.present? %>
    <%= _('Qty') %>
    <%= element.quantity %>
    <% end %> <% end %>
    <% if element.object_type == "Product" %>
    <%= link_to element.object.name, element.object.url, target: '_blank' %>
    <%= element.object.description %>
    <% if element.proposal.open? %> <%= label_tag :comment, _('Comment (optional)') %> <%= text_area_tag :comment, element.comment, onblur: "exchange.updateField(this, '#{url_for controller: :exchange_plugin_element, action: :edit, id: element.id}', {element: {comment: this.value}});" %> <% end %> <% if element.comment.present? %>
    <%= _('Comment:') %> <%= element.comment %>
    <% end %> <% elsif element.object_type == "Article" %> <% #elsif element.object_type == "CmsLearningPlugin::Learning" FIXME %>
    <%= link_to element.object.name, element.object.url, target: 'blank' %>
    <%= element.object.summary %>
    <% elsif element.object_type == "CurrencyPlugin::Currency" %> <% if element.proposal.open? %> <%= select "element", 'object_id', options_for_select(profile.currencies.collect{|c| [c.name_with_symbol, c.id]}, element.object.id), {}, class: 'title', onblur: "exchange.updateField(this, '#{url_for controller: :exchange_plugin_element, action: :edit, id: element.id}', {element: {object_id: this.value}});" %> <% else %>
    <%= element.object.name_with_symbol %>
    <% end %> <% elsif element.object_type == "ExchangePlugin::UnregisteredItem" %> <% if element.proposal.open? %>
    <%= _('Unregistered item') %>
    <%= label_tag :title, _('Title') %> <%= text_field_tag :title, element.object.name, onblur: "exchange.updateField(this, '#{url_for controller: :exchange_plugin_element, action: :edit, id: element.id}', {element: {object_attributes: {name: this.value}}});" %> <%= label_tag :description, _('Comment (optional)') %> <%= text_area_tag :description, element.object.description, onblur: "exchange.updateField(this, '#{url_for controller: :exchange_plugin_element, action: :edit, id: element.id}', {element: {object_attributes: {description: this.value}}});" %> <% else %>
    <%= element.object.name %>
    <%= element.object.description %>
    <% end %> <% end %>