Blame view

controllets/cocreation-paper-card-controllet/cocreation-paper-card-controllet.html 6.36 KB
97f5fe0e   Andrea Petta   cocreation paper ...
1
2
  <link rel="import" href="../../bower_components/polymer/polymer.html"/>
  <link rel="import" href="../../bower_components/paper-card/paper-card.html"/>
bbfe6cb7   Luigi Serra   updates
3
  <link rel="import" href="../../bower_components/paper-fab/paper-fab.html">
97f5fe0e   Andrea Petta   cocreation paper ...
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  <link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html"/>
  <link rel="import" href="../../bower_components/paper-button/paper-button.html"/>
  <link rel="import" href="../../bower_components/iron-icon/iron-icon.html"/>
  <link rel="import" href="../../bower_components/iron-collapse/iron-collapse.html"/>
  
  
  <dom-module id="cocreation-paper-card-controllet">
  
      <template>
          <style>
  
              iron-icon{
                  padding-left: 5px;
                  padding-right: 5px;
                  --iron-icon-height: 16px;
                  --iron-icon-width: 16px;
              }
  
              iron-icon.icon-from{
                  --iron-icon-fill-color : #000000;
              }
  
              iron-icon.icon-to{
                  --iron-icon-fill-color : #ff0000;
              }
  
              paper-card.cocreation {
                  width: 310px;
              }
  
              .from, .to {
                  font-size: 13px;
                  color: #CCCCCC;
              }
  
              .rate-content {
                  @apply(--layout-flex);
                  float: left;
                  width: 100%;
              }
  
              .rate-header { @apply(--paper-font-headline); }
              .rate-name { color: var(--paper-grey-600); margin: 10px 0; }
  
              paper-icon-button.rate-icon {
                  --iron-icon-fill-color: white;
                  --iron-icon-stroke-color: var(--paper-grey-600);
              }
  
              .collapse-content {
                  width: 200px;
                  padding: 15px;
              }
  
              iron-collapse.iron-collapse-over
              {
                  position: absolute;
                  left: -1px;
                  margin:0;
                  padding:0;
                  z-index:10;
                  background-color: #FFFFFF;
                  border: solid 1px #E6E6E6;
                  border-top: none !important;
                  min-width: 310px;
                  min-height: 188px;
              }
bbfe6cb7   Luigi Serra   updates
71
72
73
74
75
76
77
              .badge{
                  position: absolute;
                  right: 5px;
                  bottom: 5px;
                  background: #2196F3;
              }
  
f689abd6   Luigi Serra   updates
78
79
80
81
82
83
84
85
86
87
88
              .delete{
                  position: absolute;
                  right: 14px;
                  top: 23px;
                  background: #2196F3;
                  --iron-icon-height: 18px;
                  --iron-icon-width: 18px;
                  width: 24px;
                  height: 24px;
              }
  
97f5fe0e   Andrea Petta   cocreation paper ...
89
90
91
92
93
94
95
96
97
98
99
100
101
          </style>
  
  
          <paper-card class="cocreation">
              <div class="rate-content">
                  <div class="card-content">
                      <div class="rate-header">{{name}}</div>
                      <div class="rate-name">{{owner}}</div>
                      <div>
                          <iron-icon class="icon-from" icon="alarm"></iron-icon>
                          <span class="from">{{from}}</span>
                          <iron-icon class="icon-to" icon="alarm-off"></iron-icon>
                          <span class="to">{{to}}</span>
bbfe6cb7   Luigi Serra   updates
102
                          <template is="dom-if" if="{{!checkRoomType(roomType)}}">
d194a8ba   Luigi Serra   updates
103
                              <paper-fab mini disabled icon="assessment" class="badge data"></paper-fab>
bbfe6cb7   Luigi Serra   updates
104
105
                          </template>
                          <template is="dom-if" if="{{checkRoomType(roomType)}}">
d194a8ba   Luigi Serra   updates
106
                              <paper-fab mini disabled icon="description" class="badge knowledge"></paper-fab>
bbfe6cb7   Luigi Serra   updates
107
                          </template>
f689abd6   Luigi Serra   updates
108
109
110
                          <template is="dom-if" if="{{isOwner}}">
                              <paper-fab class="delete" mini icon="delete" on-click="_handleDeleteClick" style="background-color: #b6b6b6;"></paper-fab>
                          </template>
97f5fe0e   Andrea Petta   cocreation paper ...
111
112
113
                      </div>
                  </div>
                  <div class="card-actions">
13c53ccd   Luigi Serra   cards updates
114
                      <paper-button on-click="_onExplore">Explore</paper-button>
d194a8ba   Luigi Serra   updates
115
                      <paper-icon-button icon="expand-less" on-click="_toggle" style="float:right;"></paper-icon-button>
97f5fe0e   Andrea Petta   cocreation paper ...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
                      <iron-collapse class="iron-collapse-over" id="more_info" no-animation>
                          <div class="collapse-content">
                              {{goal}}
                          </div>
                      </iron-collapse>
                  </div>
              </div>
          </paper-card>
  
      </template>
  
      <script src="../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  
      <script>
          Polymer({
              is: "cocreation-paper-card-controllet",
  
              properties: {
                  name:{
                      type: String,
                      value: "text"
                  },
                  owner:{
                      type: String,
                      value: "text"
                  },
                  from:{
                      type: String,
                      value: "text"
                  },
                  to:{
                      type: String,
                      value: "text"
                  },
                  goal:{
                      type: String,
                      value: "text"
                  },
13c53ccd   Luigi Serra   cards updates
154
155
156
                  roomUrl: {
                      type: String,
                      value: undefined
bbfe6cb7   Luigi Serra   updates
157
158
159
160
                  },
                  roomType:{
                      type: String,
                      value: undefined
f689abd6   Luigi Serra   updates
161
162
163
164
165
166
167
168
                  },
                  isOwner: {
                      type: Boolean,
                      value: false
                  },
                  roomId:{
                      type: Number,
                      value: undefined
13c53ccd   Luigi Serra   cards updates
169
                  }
97f5fe0e   Andrea Petta   cocreation paper ...
170
171
172
173
174
175
176
177
178
179
              },
  
              attached: function(){
              },
  
              _toggle: function(){
                  var moreInfo = this.$.more_info;
                  var iconButton = Polymer.dom(event).localTarget;
                  iconButton.icon = moreInfo.opened ? 'expand-less' : 'expand-more';
                  moreInfo.toggle();
13c53ccd   Luigi Serra   cards updates
180
181
              },
  
f689abd6   Luigi Serra   updates
182
183
184
185
              _handleDeleteClick: function(e){
                  this.fire("cocreation-paper-card-controllet_delete", {roomId: this.roomId});
              },
  
13c53ccd   Luigi Serra   cards updates
186
187
              _onExplore: function(e){
                  window.location = this.roomUrl;
bbfe6cb7   Luigi Serra   updates
188
              },
97f5fe0e   Andrea Petta   cocreation paper ...
189
  
bbfe6cb7   Luigi Serra   updates
190
              checkRoomType: function(type){
f689abd6   Luigi Serra   updates
191
                 return (type == "knowledge") ? true : false;
bbfe6cb7   Luigi Serra   updates
192
              }
97f5fe0e   Andrea Petta   cocreation paper ...
193
194
195
196
          })
      </script>
  
  </dom-module>