tests: add base_attr_optional.nit
[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 is i18n
17
18 import template
19 import gettext
20
21 # Header for a Opportunity page
22 class OpportunityHeader
23 super Template
24
25 # Javascript code that is included in the `OpportunityPage`
26 var page_js: String = "" is writable # FIXME remove static type when #1530 is fixed
27
28 redef fun rendering do
29 add """
30 <!DOCTYPE html>
31 <html>
32 <head>
33 <title>{{{"Opportunity - The meetup planner"}}}</title>
34 <meta charset="utf-8">
35 <meta name="viewport" content="width=device-width, initial-scale=1">
36 <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
37 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
38 <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
39 <script>
40 {{{page_js}}}
41 </script>
42 <style>
43 .menu {
44 background-color: #0d8921;
45 background-repeat: repeat-x;
46 color: white;
47 }
48 .navbar-brand{
49 color: white;
50 }
51 .navbar-brand:hover{
52 color: #EEEEEE;
53 }
54 .navbar-nav{
55 color: white;
56 }
57 .navbar-nav: hover{
58 background-color: #0d8921;
59 color: white;
60 }
61 .answer:hover {
62 cursor:pointer;
63 }
64 .opportunity-action:hoverĀ {
65 cursor:pointer;
66 }
67 </style>
68 </head>
69 <body>
70 <nav class="menu" role="navigation">
71 <div class="container">
72 <div class="navbar-header">
73 <a class="navbar-brand" href="./" >{{{"Opportunity"}}}</a>
74 </div>
75 </div>
76 </nav>
77 <div class="container">
78 """
79 end
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 %1!".format("<a href=\"http://nitlanguage.org/\">Nit</a>")}}}
96 </p>
97 </div>
98 </div>
99 </body>
100 </html>
101 """
102 end
103 end
104
105 # Any Opportunity page that contains the header, body and footer.
106 class OpportunityPage
107 super Template
108
109 # The HTML code of the header and of the banner.
110 var header = new OpportunityHeader
111
112 # The HTML code of the body.
113 var body: Writable = "" is writable
114
115 # The HTML code of the footer.
116 var footer = new OpportunityFooter
117
118 redef fun rendering do
119 add header
120 add body
121 add footer
122 end
123
124 end