commit
3ffbf4179e
@ -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,35 @@
|
||||
<h3><%=l(:label_first_page_made)%></h3>
|
||||
|
||||
<%= form_tag(:controller => 'admin', :action => 'web_footer_made') do%>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='web_title'><%= l(:label_web_title) %>:</label>
|
||||
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</p>
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
|
||||
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
|
||||
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'}%></li>
|
||||
<li><%= link_to l(:label_web_footer_page),{:action => 'web_footer_made'} , :class => 'selected' %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div style="float:right"><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %></div>
|
||||
<h4><%=l(:label_web_footer_page)%></h4>
|
||||
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='organizer_name'> <%= l(:label_organizer_name) %>:</label>
|
||||
<%= text_field_tag 'organizer_name', params[:label_organizer_name], :value => @organizer.nil? ? "":@organizer.name,:size => 30,:style => "font-size:small;width:497px;margin-left:80px;" %>
|
||||
</p>
|
||||
<p style="margin-left:60px;padding-right: 20px;">
|
||||
<label for='web_footer_oranizer_description' style="vertical-align: top"> <%= l(:label_web_footer_description)%>:</label>
|
||||
<!-- <#%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> -->
|
||||
<%= text_area 'web_footer_oranizer', 'description', :value => @organizer.nil? ? "" : @organizer.description,:cols => 80, :rows => 15, :class => 'wiki-edit' %>
|
||||
<%= wikitoolbar_for 'web_footer_oranizer_description' %>
|
||||
</p>
|
||||
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
|
||||
<% end %>
|
||||
<div>
|
||||
|
||||
|
||||
|
||||
</div>
|
@ -0,0 +1,19 @@
|
||||
<h3><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %> » <%=l(:label_edit_company)%></h3>
|
||||
<%= labelled_form_for @company do |f| %>
|
||||
<%= error_messages_for 'tracker' %>
|
||||
|
||||
<div>
|
||||
<div class="box tabular">
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.text_field :url, :required => true %></p>
|
||||
<p><%= l(:label_url_prompt) %></p>
|
||||
<p>
|
||||
<label for='attachments_fields'> <%= l(:label_upload_logo) %>:</label>
|
||||
</p>
|
||||
<div style="margin-left: 75px;" id="avatar">
|
||||
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@company} %>
|
||||
</div>
|
||||
</div>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
</div>
|
||||
<% end %>
|
@ -0,0 +1,11 @@
|
||||
<div class="contextual"><%= link_to l(:label_new_company), new_web_footer_company_path,:class => "icon icon-add" %></div>
|
||||
<h3><%=l(:label_web_footer_cooperation_compnay)%></h3>
|
||||
|
||||
<div id="logo_link">
|
||||
<% @companys.each do |company| %>
|
||||
<span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span>
|
||||
<%= link_to l(:button_edit),edit_web_footer_company_path(company) %>
|
||||
<%= delete_link web_footer_company_path(company) %>
|
||||
<hr/>
|
||||
<% end %>
|
||||
</div>
|
@ -0,0 +1,13 @@
|
||||
<h3><%= link_to l(:label_cooperation_compnay), web_footer_companies_path %> » <%=l(:label_new_company)%></h3>
|
||||
<%= labelled_form_for @company do |f| %>
|
||||
<%= error_messages_for 'tracker' %>
|
||||
|
||||
<div>
|
||||
<div class="box tabular">
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.text_field :url, :required => true %></p>
|
||||
<p><%= l(:label_url_prompt) %></p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
</div>
|
||||
<% 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