Featured mission layout

jamesperet 10 年之前
父節點
當前提交
bb4582320d
共有 3 個文件被更改,包括 55 次插入7 次删除
  1. 31 6
      app/assets/stylesheets/avalanche_theme.css.less
  2. 1 1
      app/controllers/missions_controller.rb
  3. 23 0
      app/views/missions/index.html.erb

+ 31 - 6
app/assets/stylesheets/avalanche_theme.css.less

@@ -46,24 +46,41 @@ h2 {
46 46
 	transition: all 0.2s ease-in-out;
47 47
 }
48 48
 
49
+.box {
50
+	border-radius: 4px;
51
+	border: 2px solid #D4D4DE;
52
+	line-height: 20px;
53
+	-webkit-transition: all 0.2s ease-in-out;
54
+	-moz-transition: all 0.2s ease-in-out;
55
+	-o-transition: all 0.2s ease-in-out;
56
+	transition: all 0.2s ease-in-out;
57
+}
58
+
49 59
 .thumbnail h3 {
50 60
 	font-family: Avenir-HeavyOblique;
51 61
 	font-size: 24px;
52 62
 	color: #000000;
53
-	line-height: 33px;
54 63
 	margin-bottom: 0px;
55 64
 	line-height: 28px;
56 65
 }
57 66
 
58
-.thumbnail h3 a {
67
+.box h3 {
68
+	font-family: Avenir-HeavyOblique;
69
+	font-size: 24px;
70
+	color: #000000;
71
+	line-height: 28px;
72
+	margin-bottom: 0px;
73
+}
74
+
75
+.thumbnail h3 a, .box h3 a {
59 76
 	color: black;
60 77
 }
61 78
 
62
-.thumbnail h3 a:hover {
79
+.thumbnail h3 a:hover, .box h3 a:hover {
63 80
 	text-decoration: underline;
64 81
 }
65 82
 
66
-.thumbnail p {
83
+.thumbnail p, .box p {
67 84
 	font-family: Avenir-Medium;
68 85
 	font-size: 16px;
69 86
 	color: #000000;
@@ -74,7 +91,12 @@ h2 {
74 91
 	padding: 4px;
75 92
 }
76 93
 
77
-.thumbnail .mission-director-name {
94
+.box .box-content {
95
+	padding-right: 4px;
96
+	margin-left: -26px;
97
+}
98
+
99
+.thumbnail .mission-director-name, .box .mission-director-name {
78 100
 	margin-bottom: 8px;
79 101
 	/* James Peret: */
80 102
 	font-family: Avenir-Medium;
@@ -84,11 +106,14 @@ h2 {
84 106
 }
85 107
 
86 108
 .thumbnail-mission-description { height: 110px;}
109
+.box-mission-description { height:386px;}
87 110
 
88
-.thumbnails.mission-list {
111
+.thumbnails.mission-list, .box {
89 112
 	margin-bottom: 60px;
90 113
 }
91 114
 
115
+
116
+
92 117
 // Mission Status
93 118
 
94 119
 .mission-status {

+ 1 - 1
app/controllers/missions_controller.rb

@@ -4,7 +4,7 @@ class MissionsController < ApplicationController
4 4
   # GET /missions
5 5
   # GET /missions.json
6 6
   def index
7
-    @missions = Mission.all
7
+    @featured_missions = Mission.last
8 8
     @open_missions = Mission.where("status = ? OR status = ?", 1, 2)
9 9
     @finished_missions = Mission.where("status = ? OR status = ?", 3, 4)
10 10
   end

+ 23 - 0
app/views/missions/index.html.erb

@@ -2,6 +2,29 @@
2 2
   <h1>Missions <%= link_to 'New Mission', new_mission_path, class: 'btn btn-success' %></h1>
3 3
 </div>
4 4
 
5
+<%= content_tag(:h2, (t 'mission.featured_missions'))%>
6
+
7
+<%= content_tag(:div, class: 'row-fluid box') do %>
8
+	<%= content_tag(:div, class: 'span8') do %>
9
+		<%= image_tag('http://placehold.it/1200x780')%>
10
+	<% end %>
11
+	<%= content_tag(:div, class: 'span4') do %>
12
+		<%= content_tag(:div, class: 'box-content') do%>
13
+	          <%= content_tag(:h3, link_to(@featured_missions.title, @featured_missions)) %>
14
+			<%= content_tag(:p, @featured_missions.owner.full_name, class: 'mission-director-name') %>
15
+	          <%= content_tag(:p, @featured_missions.objective, class: 'box-mission-description') %>
16
+			<%= content_tag(:div) do %>
17
+				<%= mission_agent_counter(@featured_missions) %>
18
+				<%= status(@featured_missions.status) %>
19
+				<%= mission_steps_counter(@featured_missions) %>
20
+			<% end %>
21
+		<% end %>
22
+	<% end %>
23
+<% end %>
24
+
25
+
26
+
27
+
5 28
 <%= content_tag(:h2, (t 'mission.open_missions'))%>
6 29
 
7 30
 <%= content_tag(:ul, class: 'thumbnails mission-list') do %>