forked from joshnuss/spree-contact-form
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Admin::ContactTopicsController < Admin::BaseController | ||
resource_controller | ||
|
||
create.wants.html { redirect_to collection_path } | ||
update.wants.html { redirect_to collection_path } | ||
|
||
new_action.response do |wants| | ||
wants.html {render :action => :new, :layout => !request.xhr?} | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module Admin::ContactTopicsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<%- locals = {:f => f} %> | ||
<%= render "shared/error_messages", :target => f.object %> | ||
<%= hook :admin_contact_topic_form, locals do %> | ||
<%= f.field_container :name do %> | ||
<%= f.label :name, t("name") %> <span class="required">*</span><br /> | ||
<%= f.text_field :name, :class => 'fullwidth title' %> | ||
<%= f.error_message_on :name %> | ||
<% end %> | ||
<%= f.field_container :emails do %> | ||
<%= f.label :emails, t("emails") %> (<%= t('comma_delimited') %>) <span class="required">*</span><br /> | ||
<%= f.text_field :emails, :class => 'fullwidth title' %> | ||
<%= f.error_message_on :emails %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<%= form_for(@contact_topic, :url => object_url, :html => { :method => :put }) do |f| %> | ||
<%= render :partial => 'form', :locals => {:f => f} %> | ||
<%= render :partial => 'admin/shared/edit_resource_links' %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<div class='toolbar'> | ||
<ul class='actions'> | ||
<li id="new_contact_topic_link"> | ||
<%= button_link_to t("new_contact_topic"), new_object_url, {:remote => true, :icon => 'add'} %> | ||
</li> | ||
</ul> | ||
<br class='clear' /> | ||
</div> | ||
|
||
<h1><%= t("contact_topics")%></h1> | ||
|
||
<div id="new_contact_topic"></div> | ||
|
||
<table class="index"> | ||
<tr> | ||
<%= hook :admin_contact_topic_index_headers do %> | ||
<th><%= t("name") %></th> | ||
<th><%= t("emails") %></th> | ||
<% end %> | ||
<th> | ||
<%= hook :admin_contact_topic_index_header_actions %> | ||
</th> | ||
</tr> | ||
<% @contact_topics.each do |topic| %> | ||
<tr id="<%= dom_id topic %>"> | ||
<%- locals = {:topic => topic} %> | ||
<%= hook :admin_contact_topics_index_rows, locals do %> | ||
<td><%= topic.name %></td> | ||
<td><%= topic.emails %></td> | ||
<% end %> | ||
<td class="actions"> | ||
<%= hook :admin_contact_topics_index_row_actions, locals do %> | ||
<%= link_to_edit topic %> | ||
| ||
<%= link_to_delete topic %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<%= form_for(@contact_topic, :url => collection_url) do |f| %> | ||
<%= render :partial => 'form', :locals => {:f => f} %> | ||
<%= render :partial => 'admin/shared/new_resource_links' %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
Rails.application.routes.draw do | ||
resource :contact, :controller => 'contact' | ||
|
||
namespace :admin do | ||
resources :contact_topics | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
class SpreeContactFormHooks < Spree::ThemeSupport::HookListener | ||
insert_after :admin_configurations_menu do | ||
"<%= configurations_menu_item(I18n.t('contact_topics'), admin_contact_topics_path, I18n.t('contact_topics_description')) %>" | ||
end | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'spec_helper' | ||
|
||
describe Admin::ContactTopicsController do | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'spec_helper' | ||
|
||
describe Admin::ContactTopicsHelper do | ||
end |