50d2c676353f6d9c796efa6201020cbbb58a9ab4
[nit.git] / contrib / opportunity / src / templates / boilerplate.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License
14
15 # Contains the main components of a webpage for Opportunity
16 module boilerplate
17
18 import template
19
20 # Header for a Opportunity page
21 class OpportunityHeader
22 super Template
23
24 # Javascript code that is included in the `OpportunityPage`
25 var page_js = "" is writable
26
27 redef fun rendering do
28 add """
29 <!DOCTYPE html>
30 <html>
31 <head>
32 <title>Opportunity - The meetup planner</title>
33 <meta charset="utf-8">
34 <meta name="viewport" content="width=device-width, initial-scale=1">
35 <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
36 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
37 <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
38 <script>
39 {{{page_js}}}
40 </script>
41 <style>
42 .menu {
43 background-color: #0d8921;
44 background-repeat: repeat-x;
45 color: white;
46 }
47 .navbar-brand{
48 color: white;
49 }
50 .navbar-brand:hover{
51 color: #EEEEEE;
52 }
53 .navbar-nav{
54 color: white;
55 }
56 .navbar-nav: hover{
57 background-color: #0d8921;
58 color: white;
59 }
60 .answer:hover {
61 cursor:pointer;
62 }
63 .opportunity-action:hoverĀ {
64 cursor:pointer;
65 }
66 </style>
67 </head>
68 <body>
69 <nav class="menu" role="navigation">
70 <div class="container">
71 <div class="navbar-header">
72 <a class="navbar-brand" href="./" >Opportunity</a>
73 </div>
74 </div>
75 </nav>
76 <div class="container">
77 """
78 end
79
80 end
81
82 # Footer for a Opportunity page
83 class OpportunityFooter
84 super Template
85
86 redef fun rendering do
87 add """
88 </div>
89 <div class="footer">
90 <div class="well well-sm">
91 <p class="text-muted text-center">
92 Opportunity, the meetup planner.
93 </p>
94 <p class="text-muted text-center">
95 Proudly powered by <a href="http://nitlanguage.org/">Nit</a>!
96 </p>
97 </div>
98 </div>
99 </body>
100 </html>
101 """
102 end
103
104 end
105
106 # Any Opportunity page that contains the header, body and footer.
107 class OpportunityPage
108 super Template
109
110 var header = new OpportunityHeader
111
112 var body: Streamable = "" is writable
113
114 var footer = new OpportunityFooter
115
116 redef fun rendering do
117 add header
118 add body
119 add footer
120 end
121
122 end