瀏覽代碼

Add corp logo, cleanup.

old-ruby
Ben Kurtovic 9 年之前
父節點
當前提交
972715475c
共有 9 個檔案被更改,包括 28 行新增17 行删除
  1. +5
    -0
      app/assets/stylesheets/application.css
  2. +3
    -2
      app/helpers/admin_helper.rb
  3. +8
    -5
      app/helpers/application_helper.rb
  4. +0
    -4
      app/helpers/tools_helper.rb
  5. +1
    -1
      app/views/admin/index.html.erb
  6. +1
    -1
      app/views/shared/_footer.html.erb
  7. +4
    -0
      app/views/shared/_header.html.erb
  8. +1
    -1
      app/views/tools/index.html.erb
  9. +5
    -3
      db/seeds.rb

+ 5
- 0
app/assets/stylesheets/application.css 查看文件

@@ -13,3 +13,8 @@
*= require_tree .
*= require_self
*/

img#corp_logo {
width: 64px;
height: 64px;
}

+ 3
- 2
app/helpers/admin_helper.rb 查看文件

@@ -1,8 +1,9 @@
module AdminHelper
SETTINGS = [
{:key => 'site_name', :label => 'Site name'},
{:key => 'corporation', :label => 'Corporation'},
{:key => 'description', :label => 'Home page description', :textarea => true},
{:key => 'corp_name', :label => 'Corporation name'},
{:key => 'corp_id', :label => 'Corporation ID', :size => 10},
{:key => 'description', :label => 'Welcome message', :textarea => true},
{:key => 'copyright', :label => 'Copyright'},
]
end

+ 8
- 5
app/helpers/application_helper.rb 查看文件

@@ -7,13 +7,16 @@ module ApplicationHelper
title.empty? ? base : "#{title} : #{base}"
end

def get_copyright_year
def corp_logo_tag
corp_id = AdminSetting.get('corp_id')
corp_name = AdminSetting.get('corp_name')
image_tag("https://image.eveonline.com/Corporation/#{corp_id}_256.png",
id: 'corp_logo', title: corp_name, alt: "#{corp_name} Logo")
end

def copyright_year
start = 2015
year = Time.now.year
year > start ? "#{start}–#{year}" : start
end

def get_copyright_holders
AdminSetting.get('copyright')
end
end

+ 0
- 4
app/helpers/tools_helper.rb 查看文件

@@ -1,6 +1,2 @@
module ToolsHelper

def get_description
AdminSetting.get('description')
end
end

+ 1
- 1
app/views/admin/index.html.erb 查看文件

@@ -10,7 +10,7 @@
<% if s[:textarea] %>
<td><%= text_area_tag("settings[#{s[:key]}]", AdminSetting.get(s[:key]), size: "60x5") %></td>
<% else %>
<td><%= text_field_tag("settings[#{s[:key]}]", AdminSetting.get(s[:key]), size: 40) %></td>
<td><%= text_field_tag("settings[#{s[:key]}]", AdminSetting.get(s[:key]), size: s[:size] || 40) %></td>
<% end %>
</tr>
<% end %>


+ 1
- 1
app/views/shared/_footer.html.erb 查看文件

@@ -1,6 +1,6 @@
<div id="footer">
<p>
Copyright &copy; <%= get_copyright_year %> <%= get_copyright_holders %>
Copyright &copy; <%= copyright_year %> <%= AdminSetting.get('copyright') %>
&bull;
Running <a href="//github.com/earwig/calefaction">Calefaction</a> <%= Calefaction::Version::VERSION_STRING %>
&bull;


+ 4
- 0
app/views/shared/_header.html.erb 查看文件

@@ -1,4 +1,8 @@
<div id="header">
<h1>
<%= corp_logo_tag %>
<%= AdminSetting.get('corp_name') %>
</h1>
<p>
<%= link_to 'Home', controller: 'tools', action: 'index' %>
</p>


+ 1
- 1
app/views/tools/index.html.erb 查看文件

@@ -2,4 +2,4 @@

<p>Tools: ...</p>

<p><%= get_description %></p>
<p><%= AdminSetting.get('description') %></p>

+ 5
- 3
db/seeds.rb 查看文件

@@ -6,7 +6,9 @@
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)

AdminSetting.add('site_name', 'Your Corporation Site')
AdminSetting.add('corporation', 'Your Corporation')
AdminSetting.add('description', 'Your corporation\'s description goes here!')
AdminSetting.add('site_name', 'Your Corporation\'s Site')
AdminSetting.add('corp_name', 'Your Corporation')
AdminSetting.add('corp_id', '1')
AdminSetting.add('copyright', 'Your Corporation/Your Name')
AdminSetting.add('description',
'Welcome to your corporation\'s website! This message can be changed in the admin settings panel.')

Loading…
取消
儲存