Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2068 | es | 1 | <%@ page import="org.json.JSONObject" %> |
2 | <%@ page import="org.json.JSONArray" %> |
||
3 | <%@ page import="pt.estgp.es.exemplos.hibernate.Seccao" %> |
||
4 | <%@ page import="pt.estgp.es.exemplos.hibernate.SeccaoImpl" %> |
||
5 | <%@ page import="java.util.List" %> |
||
6 | <%@ page import="java.util.ArrayList" %> |
||
7 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
||
8 | |||
9 | <html> |
||
10 | <head> |
||
11 | </head> |
||
12 | <body > |
||
13 | |||
14 | |||
15 | <!-- MINIMO USANDO TILES DAQUI PARA DIANTE--> |
||
16 | |||
17 | <!-- Latest compiled and minified CSS --> |
||
18 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> |
||
19 | <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> |
||
20 | <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> |
||
21 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> |
||
22 | <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> |
||
23 | |||
24 | |||
25 | <script type="text/javascript" src="<%=request.getContextPath()%>/exemplos/angular-pageslide-directive.js"></script> |
||
26 | |||
27 | |||
28 | <script src="<%=request.getContextPath()%>/js/rest-layer.js"></script> |
||
29 | |||
30 | |||
31 | |||
32 | <style> |
||
33 | .ng-pageslide{ |
||
34 | background-color: rgb(230,230,181); |
||
35 | overflow: scroll; |
||
36 | } |
||
37 | body.ng-pageslide-body-open::before{ |
||
38 | content: '.'; |
||
39 | display: block; |
||
40 | position: absolute; |
||
41 | top: 0; |
||
42 | background-color: rgb(230,230,181); |
||
43 | left: 0; |
||
44 | right: 0; |
||
45 | bottom: 0; |
||
46 | z-index: 1; |
||
47 | opacity: 0.5; |
||
48 | transition: opacity 1s; |
||
49 | opacity: 0.57; |
||
50 | pointer-events: all; |
||
51 | } |
||
52 | |||
53 | body.ng-pageslide-body-closed::before{ |
||
54 | transition: opacity 1s; |
||
55 | content: '.'; |
||
56 | display: block; |
||
57 | position: absolute; |
||
58 | top: 0; |
||
59 | background-color: rgb(0,0,0); |
||
60 | left: 0; |
||
61 | right: 0; |
||
62 | bottom: 0; |
||
63 | z-index: 1; |
||
64 | opacity: 0; |
||
65 | pointer-events: none; |
||
66 | } |
||
67 | </style> |
||
68 | |||
69 | <div ng-app="testePageSlide" ng-controller="testePageSlideController" id="testePageSlide"> |
||
70 | |||
71 | |||
72 | <% |
||
73 | |||
74 | Seccao s1 = new SeccaoImpl(); |
||
75 | s1.setTitulo("Teste 1"); |
||
76 | s1.setId(1); |
||
77 | |||
78 | Seccao s2 = new SeccaoImpl(); |
||
79 | s2.setTitulo("Teste 2"); |
||
80 | s2.setId(2); |
||
81 | |||
82 | List<Seccao> seccoes = new ArrayList<>(); |
||
83 | seccoes.add(s1); |
||
84 | seccoes.add(s2); |
||
85 | |||
86 | JSONObject js = new JSONObject(); |
||
87 | JSONArray arr = new JSONArray(); |
||
88 | |||
89 | for(Seccao s : seccoes) |
||
90 | { |
||
91 | JSONObject sobj1 = new JSONObject(); |
||
92 | sobj1.put("titulo",s.getTitulo()); |
||
93 | sobj1.put("id",s.getId()); |
||
94 | arr.put(sobj1); |
||
95 | } |
||
96 | |||
97 | js.put("seccoes",arr); |
||
98 | |||
99 | |||
100 | %> |
||
101 | |||
102 | <script> |
||
103 | var testePageSlide = angular.module('testePageSlide', ['pageslide-directive']); |
||
104 | |||
105 | |||
106 | testePageSlide.controller('testePageSlideController', function ($scope) |
||
107 | { |
||
108 | $scope.seccoes = <%=js.toString()%>; |
||
109 | $scope.seccaoEdit = null; |
||
110 | $scope.inSlide = "Hello Slide"; |
||
111 | $scope.slideOpened = false; |
||
112 | $scope.isSlideOpened = function() { return $scope.slideOpened; }; |
||
113 | $scope.openSlide = function() { $scope.slideOpened = true; }; |
||
114 | $scope.closeSlide = function() { $scope.slideOpened = false; }; |
||
115 | $scope.toogleSlide = function() { $scope.slideOpened = !$scope.slideOpened; }; |
||
116 | |||
117 | |||
118 | $scope.editSeccao = function(s) { |
||
119 | $scope.seccaoEdit = s; |
||
120 | $scope.openSlide(); |
||
121 | }; |
||
122 | |||
123 | |||
124 | |||
125 | |||
126 | |||
127 | $scope.saveSeccao = function(s){ |
||
128 | |||
129 | rest( |
||
130 | "<%=request.getContextPath()%>/ws/api/login", |
||
131 | "saveSeccao", |
||
132 | { |
||
133 | seccao: s |
||
134 | }, |
||
135 | "#testePageSlide", |
||
136 | function(resposta){ |
||
137 | alert("ok:" + resposta.result); |
||
138 | $scope.closeSlide(); |
||
139 | $scope.$apply(); |
||
140 | }, |
||
141 | function(resposta){ |
||
142 | alert("ok:" + resposta); |
||
143 | } |
||
144 | ); |
||
145 | } |
||
146 | |||
147 | |||
148 | |||
149 | |||
150 | |||
151 | }); |
||
152 | </script> |
||
153 | |||
154 | <div class="web-messages"></div> |
||
155 | |||
156 | <div id="slide" pageslide <%--ps-push="true"--%> ps-open="isSlideOpened()" ps-size="50%" <%--ps-size="1000px"--%> style="max-width: 100%;" ps-key-listener="false" ps-click-outside="false"> |
||
157 | <div class="web-messages"></div> |
||
158 | <h1>{{inSlide}}</h1> |
||
159 | |||
160 | ID: {{seccaoEdit.id}} |
||
161 | <br/> |
||
162 | TITULO: <input type="text" ng-model="seccaoEdit.titulo"> |
||
163 | <button ng-click="saveSeccao(seccaoEdit)">Salvar</button> |
||
164 | <button ng-click="toogleSlide()">Toggle Slide</button> |
||
165 | </div> |
||
166 | |||
167 | <button ng-click="openSlide()">Open Slide</button> |
||
168 | <button ng-click="toogleSlide()">Toggle Slide</button> |
||
169 | |||
170 | |||
171 | <table> |
||
172 | <thead> |
||
173 | <tr> |
||
174 | <th>ID</th> |
||
175 | <th>TITULO</th> |
||
176 | </tr> |
||
177 | </thead> |
||
178 | <tbody> |
||
179 | <tr ng-repeat="s in seccoes.seccoes"> |
||
180 | <th>{{s.id}}</th> |
||
181 | <th>{{s.titulo}}</th> |
||
182 | <th><button type="button" ng-click="editSeccao(s)">EDITAR</button></th> |
||
183 | </tr> |
||
184 | </tbody> |
||
185 | </table> |
||
186 | |||
187 | <pre> |
||
188 | {{seccoes | json}} |
||
189 | </pre> |
||
190 | |||
191 | |||
192 | </div> |
||
193 | <!-- FIM DO MINIMO PARA PAGESLIDE USANDO TILES--> |
||
194 | |||
195 | </body> |
||
196 | </html> |