parent
328b9b5e5b
commit
f957666b25
@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the WebFooterCompany controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,50 @@
|
|||||||
|
class WebFooterCompaniesController < ApplicationController
|
||||||
|
layout 'admin'
|
||||||
|
menu_item :projects, :only => :projects
|
||||||
|
menu_item :plugins, :only => :plugins
|
||||||
|
menu_item :info, :only => :info
|
||||||
|
before_filter :require_admin
|
||||||
|
|
||||||
|
def index
|
||||||
|
@companys = WebFooterCompany.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@company = WebFooterCompany.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@company = WebFooterCompany.new(params[:web_footer_company])
|
||||||
|
if @company.save
|
||||||
|
flash[:notice] = l(:notice_successful_create)
|
||||||
|
redirect_to web_footer_companies_path
|
||||||
|
else
|
||||||
|
flash[:error] = "#{l :web_footer_company_create_fail}: #{@company.errors.full_messages[0]}"
|
||||||
|
new
|
||||||
|
render :action => 'new'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@company = WebFooterCompany.find(params[:id])
|
||||||
|
@company.destroy
|
||||||
|
redirect_to web_footer_companies_path
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@company = WebFooterCompany.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@company = WebFooterCompany.find(params[:id])
|
||||||
|
if @company.update_attributes(params[:web_footer_company])
|
||||||
|
flash[:notice] = l(:notice_successful_update)
|
||||||
|
redirect_to web_footer_companies_path
|
||||||
|
else
|
||||||
|
flash[:error] = "#{l :web_footer_company_update_fail}: #{@company.errors.full_messages[0]}"
|
||||||
|
edit
|
||||||
|
render :action => 'edit'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,2 @@
|
|||||||
|
module WebFooterCompaniesHelper
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class WebFooterCompany < ActiveRecord::Base
|
||||||
|
attr_accessible :logo_size, :name, :url
|
||||||
|
validates_presence_of :name,:url
|
||||||
|
validates_length_of :name,:url, :maximum => 255
|
||||||
|
validates_format_of :url,:with => /(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/,:message => l(:is_not_url_error)
|
||||||
|
end
|
@ -0,0 +1,3 @@
|
|||||||
|
class WebFooterOranizer < ActiveRecord::Base
|
||||||
|
attr_accessible :description, :name
|
||||||
|
end
|
@ -0,0 +1,10 @@
|
|||||||
|
class CreateWebFooterOranizers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :web_footer_oranizers do |t|
|
||||||
|
t.string :name
|
||||||
|
t.text :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
class CreateWebFooterCompanies < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :web_footer_companies do |t|
|
||||||
|
t.string :name
|
||||||
|
t.string :logo_size
|
||||||
|
t.string :url
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,11 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
logo_size: MyString
|
||||||
|
url: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
||||||
|
logo_size: MyString
|
||||||
|
url: MyString
|
@ -0,0 +1,9 @@
|
|||||||
|
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
||||||
|
description: MyText
|
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class WebFooterCompaniesControllerTest < ActionController::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class WebFooterCompaniesHelperTest < ActionView::TestCase
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class WebFooterCompanyTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class WebFooterOranizerTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
Loading…
Reference in new issue