spina_contact_forms 0.1.0
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.
- checksums.yaml +7 -0
 - data/MIT-LICENSE +20 -0
 - data/README.md +47 -0
 - data/Rakefile +37 -0
 - data/app/assets/config/spina_contact_forms_manifest.js +0 -0
 - data/app/controllers/spina/admin/contact_form_elements_controller.rb +35 -0
 - data/app/controllers/spina/admin/contact_forms_controller.rb +20 -0
 - data/app/controllers/spina/contact_forms_controller.rb +9 -0
 - data/app/helpers/spina_contact_forms/contact_forms_helper.rb +15 -0
 - data/app/mailers/spina/contact_form_mailer.rb +11 -0
 - data/app/models/application_record.rb +3 -0
 - data/app/models/spina/contact_form_element.rb +13 -0
 - data/app/models/spina.rb +5 -0
 - data/app/views/layouts/mailers/spina_contact_form.html.erb +13 -0
 - data/app/views/layouts/mailers/spina_contact_form.text.erb +1 -0
 - data/app/views/spina/admin/contact_form_elements/_contact_form_element.html.haml +4 -0
 - data/app/views/spina/admin/contact_form_elements/create.js.erb +2 -0
 - data/app/views/spina/admin/contact_form_elements/error.js.erb +1 -0
 - data/app/views/spina/admin/contact_forms/_form.html.haml +27 -0
 - data/app/views/spina/admin/contact_forms/index.html.haml +17 -0
 - data/app/views/spina/admin/hooks/contact_forms/_website_secondary_navigation.html.haml +3 -0
 - data/app/views/spina/contact_form_mailer/send_form.html.haml +3 -0
 - data/app/views/spina/contact_form_mailer/send_form.text.erb +4 -0
 - data/app/views/spina/contact_forms/_page.html.haml +8 -0
 - data/app/views/spina/contact_forms/create.js.erb +1 -0
 - data/config/locales/contact_form_de.yml +3 -0
 - data/config/locales/contact_form_en.yml +3 -0
 - data/config/routes.rb +10 -0
 - data/db/migrate/20170329144025_create_spina_contact_form_elements.rb +11 -0
 - data/lib/spina_contact_forms/engine.rb +15 -0
 - data/lib/spina_contact_forms/version.rb +3 -0
 - data/lib/spina_contact_forms.rb +5 -0
 - data/lib/tasks/spina_contact_forms_tasks.rake +4 -0
 - metadata +118 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ce90c4eeae5bba5a1617cf63655b0bf7e8239b4e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bef83c4aabd8eecfc4884ccbee00bc24ffc203cd
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: eb5758cde440fcca05cefb44f17dc704fe0511a622036a98f4116f63b50048c6a7394bea5a1862562b2cce2c200dc833e84b41d7218c0fdc5a796606a8e6a557
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e2d35d4ea63ab29169de5986c46ac892a8467fc4bab517e2d68bb00bda6ccf79518f7409d1cd232c293dfbfd9db9566b34480cd8200c6ea1d4e38f7af16bd5c2
         
     | 
    
        data/MIT-LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright 2017 Adam Cooper
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 4 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 5 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 6 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 7 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 8 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 9 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 12 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 15 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 16 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 17 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 18 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 19 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 20 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # SpinaContactForms
         
     | 
| 
      
 2 
     | 
    
         
            +
            This will add a contact form builder for spina. You can create form elements in the backend that will populate the form in the frontend.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 5 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 8 
     | 
    
         
            +
            gem 'spina_contact_forms', git: 'https://github.com/acapro/Spina-Contact-Forms'
         
     | 
| 
      
 9 
     | 
    
         
            +
            ```
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 12 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 13 
     | 
    
         
            +
            $ bundle
         
     | 
| 
      
 14 
     | 
    
         
            +
            ```
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            Make sure your mail settings are setup correctly.
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Add the following to `config/secrets.yml`
         
     | 
| 
      
 19 
     | 
    
         
            +
            ```
         
     | 
| 
      
 20 
     | 
    
         
            +
            contact_form_from_email: contact_form@yourdomain.com
         
     | 
| 
      
 21 
     | 
    
         
            +
            ```
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Add the following to your theme's config file (config/initializers/themes/theme_name.rb)
         
     | 
| 
      
 24 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 25 
     | 
    
         
            +
            theme.plugins = ['ContactForm']
         
     | 
| 
      
 26 
     | 
    
         
            +
            ```
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            Copy and run the migrations
         
     | 
| 
      
 29 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 30 
     | 
    
         
            +
            rake spina_contact_forms_engine:install:migrations
         
     | 
| 
      
 31 
     | 
    
         
            +
            rake db:migrate
         
     | 
| 
      
 32 
     | 
    
         
            +
            ```
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 35 
     | 
    
         
            +
            In your view, call `<%= spina_contact_form%>`
         
     | 
| 
      
 36 
     | 
    
         
            +
            That's it! Use Mailcatcher for local development, and test it out.
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 39 
     | 
    
         
            +
            Contributions are welcome! It is still in an early stage, and more features are required. Fork it, and create a pull request.
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            ## Roadmap
         
     | 
| 
      
 42 
     | 
    
         
            +
            * Currently only text inputs and text areas are supported, select dropdowns, check boxes and radio buttons still needed
         
     | 
| 
      
 43 
     | 
    
         
            +
            * Internationalization needed
         
     | 
| 
      
 44 
     | 
    
         
            +
            * Create an install generator, which copies the migrations and view files
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 47 
     | 
    
         
            +
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            begin
         
     | 
| 
      
 2 
     | 
    
         
            +
              require 'bundler/setup'
         
     | 
| 
      
 3 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 4 
     | 
    
         
            +
              puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
         
     | 
| 
      
 5 
     | 
    
         
            +
            end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            require 'rdoc/task'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            RDoc::Task.new(:rdoc) do |rdoc|
         
     | 
| 
      
 10 
     | 
    
         
            +
              rdoc.rdoc_dir = 'rdoc'
         
     | 
| 
      
 11 
     | 
    
         
            +
              rdoc.title    = 'SpinaContactForms'
         
     | 
| 
      
 12 
     | 
    
         
            +
              rdoc.options << '--line-numbers'
         
     | 
| 
      
 13 
     | 
    
         
            +
              rdoc.rdoc_files.include('README.md')
         
     | 
| 
      
 14 
     | 
    
         
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
         
     | 
| 
      
 18 
     | 
    
         
            +
            load 'rails/tasks/engine.rake'
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            load 'rails/tasks/statistics.rake'
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            require 'bundler/gem_tasks'
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            require 'rake/testtask'
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            Rake::TestTask.new(:test) do |t|
         
     | 
| 
      
 30 
     | 
    
         
            +
              t.libs << 'lib'
         
     | 
| 
      
 31 
     | 
    
         
            +
              t.libs << 'test'
         
     | 
| 
      
 32 
     | 
    
         
            +
              t.pattern = 'test/**/*_test.rb'
         
     | 
| 
      
 33 
     | 
    
         
            +
              t.verbose = false
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            task default: :test
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Spina
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Admin
         
     | 
| 
      
 3 
     | 
    
         
            +
                class ContactFormElementsController < AdminController
         
     | 
| 
      
 4 
     | 
    
         
            +
                  layout 'spina/admin/admin'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def error
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def create
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @contact_form_element = ContactFormElement.new(contact_form_element_params)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    respond_to do |format|
         
     | 
| 
      
 12 
     | 
    
         
            +
                      if @contact_form_element.save
         
     | 
| 
      
 13 
     | 
    
         
            +
                        format.html {redirect_to admin_contact_forms_path, notice: 'Form Element was successfully created.'}
         
     | 
| 
      
 14 
     | 
    
         
            +
                        format.js
         
     | 
| 
      
 15 
     | 
    
         
            +
                      else
         
     | 
| 
      
 16 
     | 
    
         
            +
                        render :error
         
     | 
| 
      
 17 
     | 
    
         
            +
                      end
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def update
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  def destroy
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  private
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  def contact_form_element_params
         
     | 
| 
      
 30 
     | 
    
         
            +
                    params.require(:contact_form_element).permit(:label, :required, :input_type)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Spina
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Admin
         
     | 
| 
      
 3 
     | 
    
         
            +
                class ContactFormsController < AdminController
         
     | 
| 
      
 4 
     | 
    
         
            +
                  layout 'spina/admin/admin'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  before_action :set_breadcrumb
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  def index
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @contact_form_element = ContactFormElement.new
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @contact_form_elements = ContactFormElement.all
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  private
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def set_breadcrumb
         
     | 
| 
      
 16 
     | 
    
         
            +
                    add_breadcrumb t('plugins.ContactForm'), admin_contact_forms_path
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module SpinaContactForms
         
     | 
| 
      
 2 
     | 
    
         
            +
              module ContactFormsHelper
         
     | 
| 
      
 3 
     | 
    
         
            +
                def spina_contact_form
         
     | 
| 
      
 4 
     | 
    
         
            +
                  render :partial => 'spina/contact_forms/page', locals: {contact_form_elements: Spina::ContactFormElement.all }
         
     | 
| 
      
 5 
     | 
    
         
            +
                end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                def spina_contact_form_input(name, type)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  if type == 'text_field'
         
     | 
| 
      
 9 
     | 
    
         
            +
                    text_field_tag name.parameterize
         
     | 
| 
      
 10 
     | 
    
         
            +
                  elsif type == 'text_area'
         
     | 
| 
      
 11 
     | 
    
         
            +
                    text_area_tag name.parameterize
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Spina
         
     | 
| 
      
 2 
     | 
    
         
            +
              class ContactFormMailer < ActionMailer::Base
         
     | 
| 
      
 3 
     | 
    
         
            +
                default from: Rails.application.secrets
         
     | 
| 
      
 4 
     | 
    
         
            +
                layout 'mailers/spina_contact_form'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                def send_form(email_content)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @email_content = email_content
         
     | 
| 
      
 8 
     | 
    
         
            +
                  mail(to: 'adam@adamcooper.de', subject: 'From your Contact Form')
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
    
        data/app/models/spina.rb
    ADDED
    
    
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <%= yield %>
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            console.log('error!!!');
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = form_for [spina, :admin, @contact_form_element], url: spina.admin_contact_form_elements_path, remote: true do |f|
         
     | 
| 
      
 2 
     | 
    
         
            +
              .well
         
     | 
| 
      
 3 
     | 
    
         
            +
                .horizontal-form
         
     | 
| 
      
 4 
     | 
    
         
            +
                  .horizontal-form-group
         
     | 
| 
      
 5 
     | 
    
         
            +
                    .horizontal-form-label
         
     | 
| 
      
 6 
     | 
    
         
            +
                      Form Label
         
     | 
| 
      
 7 
     | 
    
         
            +
                    .horizontal-form-content
         
     | 
| 
      
 8 
     | 
    
         
            +
                      = f.text_field :label, placeholder: 'Form Label'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  .horizontal-form-group
         
     | 
| 
      
 11 
     | 
    
         
            +
                    .horizontal-form-label
         
     | 
| 
      
 12 
     | 
    
         
            +
                      Required?
         
     | 
| 
      
 13 
     | 
    
         
            +
                      %small Required
         
     | 
| 
      
 14 
     | 
    
         
            +
                    .horizontal-form-content
         
     | 
| 
      
 15 
     | 
    
         
            +
                      = f.check_box :required, data: {switch: 'true'}
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  .horizontal-form-group
         
     | 
| 
      
 18 
     | 
    
         
            +
                    .horizontal-form-label
         
     | 
| 
      
 19 
     | 
    
         
            +
                      Form Type
         
     | 
| 
      
 20 
     | 
    
         
            +
                    .horizontal-form-content
         
     | 
| 
      
 21 
     | 
    
         
            +
                      .select-dropdown
         
     | 
| 
      
 22 
     | 
    
         
            +
                        = f.collection_select :input_type, Spina::ContactFormElement.input_types.map{ |el| [el.first, el.first.humanize] }, :first, :second
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  .horizontal-form-group
         
     | 
| 
      
 25 
     | 
    
         
            +
                    %button.button.button-primary{type: 'submit'}
         
     | 
| 
      
 26 
     | 
    
         
            +
                      = icon('plus')
         
     | 
| 
      
 27 
     | 
    
         
            +
                      Add Form Element
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            %header#header
         
     | 
| 
      
 2 
     | 
    
         
            +
              = render partial: 'spina/admin/shared/breadcrumbs'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            = render 'form'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            .well
         
     | 
| 
      
 7 
     | 
    
         
            +
              .table-container
         
     | 
| 
      
 8 
     | 
    
         
            +
                %table.table
         
     | 
| 
      
 9 
     | 
    
         
            +
                  %thead
         
     | 
| 
      
 10 
     | 
    
         
            +
                    %tr
         
     | 
| 
      
 11 
     | 
    
         
            +
                      %th Element Label
         
     | 
| 
      
 12 
     | 
    
         
            +
                      %th Element Type
         
     | 
| 
      
 13 
     | 
    
         
            +
                      %th Required Field?
         
     | 
| 
      
 14 
     | 
    
         
            +
                      
         
     | 
| 
      
 15 
     | 
    
         
            +
                  %tbody#contact_form_elements
         
     | 
| 
      
 16 
     | 
    
         
            +
                    - @contact_form_elements.each do |element|
         
     | 
| 
      
 17 
     | 
    
         
            +
                      = render 'spina/admin/contact_form_elements/contact_form_element', element: element
         
     | 
| 
         @@ -0,0 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            = form_tag contact_forms_path, remote: true, id: 'spina_contact_form' do
         
     | 
| 
      
 2 
     | 
    
         
            +
              - contact_form_elements.each do |element|
         
     | 
| 
      
 3 
     | 
    
         
            +
                %label
         
     | 
| 
      
 4 
     | 
    
         
            +
                  - if element.required?
         
     | 
| 
      
 5 
     | 
    
         
            +
                    *
         
     | 
| 
      
 6 
     | 
    
         
            +
                  = element.label
         
     | 
| 
      
 7 
     | 
    
         
            +
                = spina_contact_form_input(element.label, element.input_type)
         
     | 
| 
      
 8 
     | 
    
         
            +
              %button{type: 'submit'} Send
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            console.log('yeah!');
         
     | 
    
        data/config/routes.rb
    ADDED
    
    
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module SpinaContactForms
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Engine < ::Rails::Engine
         
     | 
| 
      
 3 
     | 
    
         
            +
                initializer 'spina.plugin.register.events', before: :load_config_initializers do
         
     | 
| 
      
 4 
     | 
    
         
            +
                  ::Spina::Plugin.register do |plugin|
         
     | 
| 
      
 5 
     | 
    
         
            +
                    plugin.name       = 'ContactForm'
         
     | 
| 
      
 6 
     | 
    
         
            +
                    plugin.namespace  = 'contact_forms'
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
                initializer 'spina.action_controller' do |app|
         
     | 
| 
      
 10 
     | 
    
         
            +
                  ActiveSupport.on_load :action_controller do
         
     | 
| 
      
 11 
     | 
    
         
            +
                    helper SpinaContactForms::ContactFormsHelper
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,118 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: spina_contact_forms
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Adam Cooper
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-03-30 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: rails
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 5.0.2
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 5.0.2
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: spina
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: sqlite3
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            description: Adds a contact form to Spina
         
     | 
| 
      
 56 
     | 
    
         
            +
            email:
         
     | 
| 
      
 57 
     | 
    
         
            +
            - mail@adamcooper.de
         
     | 
| 
      
 58 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 59 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 60 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 61 
     | 
    
         
            +
            files:
         
     | 
| 
      
 62 
     | 
    
         
            +
            - MIT-LICENSE
         
     | 
| 
      
 63 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 64 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 65 
     | 
    
         
            +
            - app/assets/config/spina_contact_forms_manifest.js
         
     | 
| 
      
 66 
     | 
    
         
            +
            - app/controllers/spina/admin/contact_form_elements_controller.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - app/controllers/spina/admin/contact_forms_controller.rb
         
     | 
| 
      
 68 
     | 
    
         
            +
            - app/controllers/spina/contact_forms_controller.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - app/helpers/spina_contact_forms/contact_forms_helper.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - app/mailers/spina/contact_form_mailer.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - app/models/application_record.rb
         
     | 
| 
      
 72 
     | 
    
         
            +
            - app/models/spina.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - app/models/spina/contact_form_element.rb
         
     | 
| 
      
 74 
     | 
    
         
            +
            - app/views/layouts/mailers/spina_contact_form.html.erb
         
     | 
| 
      
 75 
     | 
    
         
            +
            - app/views/layouts/mailers/spina_contact_form.text.erb
         
     | 
| 
      
 76 
     | 
    
         
            +
            - app/views/spina/admin/contact_form_elements/_contact_form_element.html.haml
         
     | 
| 
      
 77 
     | 
    
         
            +
            - app/views/spina/admin/contact_form_elements/create.js.erb
         
     | 
| 
      
 78 
     | 
    
         
            +
            - app/views/spina/admin/contact_form_elements/error.js.erb
         
     | 
| 
      
 79 
     | 
    
         
            +
            - app/views/spina/admin/contact_forms/_form.html.haml
         
     | 
| 
      
 80 
     | 
    
         
            +
            - app/views/spina/admin/contact_forms/index.html.haml
         
     | 
| 
      
 81 
     | 
    
         
            +
            - app/views/spina/admin/hooks/contact_forms/_website_secondary_navigation.html.haml
         
     | 
| 
      
 82 
     | 
    
         
            +
            - app/views/spina/contact_form_mailer/send_form.html.haml
         
     | 
| 
      
 83 
     | 
    
         
            +
            - app/views/spina/contact_form_mailer/send_form.text.erb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - app/views/spina/contact_forms/_page.html.haml
         
     | 
| 
      
 85 
     | 
    
         
            +
            - app/views/spina/contact_forms/create.js.erb
         
     | 
| 
      
 86 
     | 
    
         
            +
            - config/locales/contact_form_de.yml
         
     | 
| 
      
 87 
     | 
    
         
            +
            - config/locales/contact_form_en.yml
         
     | 
| 
      
 88 
     | 
    
         
            +
            - config/routes.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - db/migrate/20170329144025_create_spina_contact_form_elements.rb
         
     | 
| 
      
 90 
     | 
    
         
            +
            - lib/spina_contact_forms.rb
         
     | 
| 
      
 91 
     | 
    
         
            +
            - lib/spina_contact_forms/engine.rb
         
     | 
| 
      
 92 
     | 
    
         
            +
            - lib/spina_contact_forms/version.rb
         
     | 
| 
      
 93 
     | 
    
         
            +
            - lib/tasks/spina_contact_forms_tasks.rake
         
     | 
| 
      
 94 
     | 
    
         
            +
            homepage: http://www.github.com/acapro
         
     | 
| 
      
 95 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 96 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 97 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 98 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 99 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 100 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 101 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 102 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 103 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 104 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 105 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 106 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 107 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 108 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 109 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 110 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 111 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 112 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 113 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 114 
     | 
    
         
            +
            rubygems_version: 2.4.5.1
         
     | 
| 
      
 115 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 116 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 117 
     | 
    
         
            +
            summary: Spina contact form plugin
         
     | 
| 
      
 118 
     | 
    
         
            +
            test_files: []
         
     |