Skip to content

Commit

Permalink
Merge branch 'feature/add-styling'
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
Carsten Zimmermann committed Dec 9, 2014
2 parents ceab6c4 + ee50465 commit 9a9a9d2
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 53 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ strong parameters will unwillingly disable your spam protection.
### HEAD (not released yet)
* Add Beespew form builder with `honeypot` field
* Make Beespew.attribute configurable ([#1](https://github.com/Absolventa/beespew/issues/1))
* Add a default hidden style for honeypot field ([#3](https://github.com/Absolventa/beespew/issues/3))

### 0.1.0
* Initial working version
8 changes: 8 additions & 0 deletions app/assets/stylesheets/beespew/beespew.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.beespew {
position: absolute !important;
height: 1px; width: 1px;
overflow: hidden;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}

1 change: 1 addition & 0 deletions spec/dummy/app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
*
*= require_tree .
*= require_self
*= require beespew/beespew
*/
21 changes: 21 additions & 0 deletions spec/dummy/app/controllers/support_requests_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class SupportRequestsController < ApplicationController

def new
@support_request = SupportRequest.new
end

def create
@support_request = SupportRequest.new(support_request_params)
if @support_request.save
redirect_to new_support_request_path, notice: 'Support Request created.'
else
render :new
end
end

private

def support_request_params
params.require(:support_request).permit(:message, :subject, :beespew)
end
end
5 changes: 5 additions & 0 deletions spec/dummy/app/models/support_request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class SupportRequest < ActiveRecord::Base
include Beespew::Model

validates :subject, presence: true
end
27 changes: 27 additions & 0 deletions spec/dummy/app/views/support_requests/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<%= form_for @support_request, builder: Beespew::FormBuilder do |f| %>
<% unless @support_request.valid? %>
<ul>
<% @support_request.errors.full_messages.each do |err| %>
<li><%= err %></li>
<% end %>
</ul>
<% end %>

<p>
<%= f.label :subject %><br>
<%= f.text_field :subject %>
</p>

<p>
<%= f.label :message %><br>
<%= f.text_area :message %>
</p>

<%= f.honeypot %>

<p>
<%= f.submit %>
</p>

<% end %>
2 changes: 1 addition & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "sprockets/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"

Bundler.require(*Rails.groups)
Expand Down
54 changes: 2 additions & 52 deletions spec/dummy/config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,56 +1,6 @@
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
root 'support_requests#new'

# You can have the root of your site routed with "root"
# root 'welcome#index'
resources :support_requests

# Example of regular route:
# get 'products/:id' => 'catalog#view'

# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products

# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end

# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end

# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end

# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable

# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
10 changes: 10 additions & 0 deletions spec/dummy/db/migrate/20141208164522_create_support_requests.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateSupportRequests < ActiveRecord::Migration
def change
create_table :support_requests do |t|
t.string :subject
t.string :message

t.timestamps
end
end
end
23 changes: 23 additions & 0 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20141208164522) do

create_table "support_requests", force: true do |t|
t.string "subject"
t.string "message"
t.datetime "created_at"
t.datetime "updated_at"
end

end

0 comments on commit 9a9a9d2

Please sign in to comment.