Revision b3c1328b

b/snf-cyclades-app/synnefo/ui/new_ui/ui/.gitignore
1
# Numerous always-ignore extensions
2
*.pyc
3
*.diff
4
*.err
5
*.orig
6
*.log
7
*.rej
8
*.swo
9
*.swp
10
*.vi
11
*.cache
12
*~
13
*#
14

  
15
# OS or Editor folders
16
.DS_Store
17
Thumbs.db
18
.cache
19
.project
20
.settings
21
.tmproj
22
*.esproj
23
nbproject
24
*.sublime-project
25
*.sublime-workspace
26
.tm_properties
27

  
28
# Folders to ignore
29
.hg
30
.svn
31
.CVS
32
.idea
33
_assets
34
_design
35
_content
36
_tmp
37
dist
38
.sass-cache
b/snf-cyclades-app/synnefo/ui/new_ui/ui/MIT-LICENSE.txt
1
Copyright (c) 2011 ZURB, http://www.zurb.com/
2

  
3
Permission is hereby granted, free of charge, to any person obtaining
4
a copy of this software and associated documentation files (the
5
"Software"), to deal in the Software without restriction, including
6
without limitation the rights to use, copy, modify, merge, publish,
7
distribute, sublicense, and/or sell copies of the Software, and to
8
permit persons to whom the Software is furnished to do so, subject to
9
the following conditions:
10

  
11
The above copyright notice and this permission notice shall be
12
included in all copies or substantial portions of the Software.
13

  
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
b/snf-cyclades-app/synnefo/ui/new_ui/ui/config.rb
1
require 'zurb-foundation'
2
# Require any additional compass plugins here.
3

  
4

  
5
# Set this to the root of your project when deployed:
6
http_path = "/"
7
css_dir = "stylesheets"
8
sass_dir = "sass"
9
images_dir = "images"
10
javascripts_dir = "javascripts"
11

  
12
# You can select your preferred output style here (can be overridden via the command line):
13
# output_style = :expanded or :nested or :compact or :compressed
14

  
15
# To enable relative paths to assets via compass helper functions. Uncomment:
16
# relative_assets = true
17

  
18
# To disable debugging comments that display the original location of your selectors. Uncomment:
19
# line_comments = false
20

  
21

  
22
# If you prefer the indented syntax, you might want to regenerate this
23
# project again passing --syntax sass, or you can uncomment this:
24
# preferred_syntax = :sass
25
# and then run:
26
# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
b/snf-cyclades-app/synnefo/ui/new_ui/ui/cyclades-approachB.html
1
<head>
2
  <meta charset="utf-8" />
3

  
4
  <title>~okeanos|B approach</title>
5

  
6
</head>
7
<body>
8
	<div id = "header">
9
		<div id = "top-nav">
10
			<ul id = "services-nav">
11
				<li>
12
					<a href="#">
13
						Icon 1
14
						<img src="">
15
					</a>
16
				</li>
17
				<li>
18
					<a href="#">
19
						Icon 2
20
						<img src="">
21
					</a>
22
				</li>
23
				<li>
24
					<a href="#">
25
						Icon 3
26
						<img src="">
27
					</a>
28
				</li>
29
				<li>
30
					<a href="#">
31
						Icon 4
32
						<img src=""></a>
33
				</li>
34
			</ul>
35
			<div id = "profile">
36
				<a id = "usr-email" href="#">
37
					
38
					<span>
39
						user@email.com
40
					</span>
41
				</a>
42

  
43
				<ul id = "profile-options">
44
					<li>
45
						<a href="">
46
							<img src="">
47
							icon + Dashboard?
48
						</a>
49
					</li>
50

  
51
					<li>
52
						<a href="">
53
							<img src="">
54
							Icon + Log Out?
55
						</a>
56
					</li>
57
				</ul>
58
			</div>			
59
		</div>
60
	</div>
61
	
62
	<div id = "container">
63
		<div id = "sidebar-var">
64
			?
65
		</div>
66
		
67
		<div id = "content">
68
			<ul id = 'vms'>
69
				<li>
70
					
71
				</li>
72
				<li>
73
					
74
				</li>
75
				<li>
76
					
77
				</li>
78
			</ul>
79
		</div>
80
		
81
		<div id = "sidebar-const">
82
			<ul> Dn m'aresei to periexomeno k i katataksi tou menu (dn thelw ton pitho katw katw k simasiologika mallon ta nets k disks einai katw apo ta vms -> an peis oti vazoume deuterevouses epiloges tha parafortwnetai mallon)
83
				<li>
84
					<a href="#">
85
						<img src="">
86
						Icon +Virtual Machines
87
					</a>
88
				</li>
89
				<li>
90
					<a href="#">
91
						<img src="">
92
						Icon + Disks
93
					</a>
94
				</li>
95
				<li>
96
					<a href="#">
97
						<img src="">
98
						Icon + Networks
99
					</a>
100
				</li>
101
				<li>
102
					<a href="">
103
						<img src="">
104
						Icon + Pithos
105
					</a>
106
				</li>
107
				<li>
108
					Promo area with messages?
109
				</li>
110
				<li>
111
					<a href="#">
112
						Icon + Feedback? (only icon?)
113
					</a>
114
				</li>
115

  
116
			</ul>
117
			
118
		</div>
119
	</div>
120
	
121
	<div id = "footer">
122
		Copyright k ti allo?
123
	</div>
124
</body>
b/snf-cyclades-app/synnefo/ui/new_ui/ui/humans.txt
1
/* Foundation was made by ZURB, an interaction design and design strategy firm in Campbell, CA */
2
/* zurb.com */
3
/* humanstxt.org */
4

  
5
/* SITE */
6
  Standards: HTML5, CSS3
7
  Components: jQuery, Orbit, Reveal
8
  Software: Coda, Textmate, Git
b/snf-cyclades-app/synnefo/ui/new_ui/ui/images/menu-icon-vm.svg
1
<?xml version="1.0" encoding="utf-8"?>
2
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
3
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
	 width="841.89px" height="595.28px" viewBox="0 0 841.89 595.28" enable-background="new 0 0 841.89 595.28" xml:space="preserve">
6
<polygon fill="none" stroke="#B4B4B4" points="422.611,304.885 422.611,302.611 430.238,302.611 430.238,287.6 411.135,287.6 
7
	411.135,302.611 419.246,302.611 419.246,304.885 409.841,304.885 409.841,310.381 431.533,310.381 431.533,304.885 "/>
8
</svg>
b/snf-cyclades-app/synnefo/ui/new_ui/ui/images/test.svg
1
<?xml version="1.0" encoding="utf-8"?>
2
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
3
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
	 width="1000px" height="1000px" viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve">
6
<style type="text/css">
7
<![CDATA[
8
	.st0{fill:none;stroke:#FFFFFF;}
9
	.st1{font-family:'OpenSans-Light';}
10
	.st2{fill:#FEFDEE;}
11
	.st3{font-size:14;}
12
]]>
13
</style>
14
<g>
15
	<circle class="st0" cx="321.335" cy="364.04" r="14.232"/>
16
	<g>
17
		<text transform="matrix(1.0253 0 0 1 317.6167 368.7578)" class="st2 st1 st3">X</text>
18
	</g>
19
</g>
20
</svg>
b/snf-cyclades-app/synnefo/ui/new_ui/ui/index.html
1

  
2
<!DOCTYPE html>
3
<!--[if IE 8]> 				 <html class="no-js lt-ie9" lang="en"> <![endif]-->
4
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
5

  
6
<head>
7
	<meta charset="utf-8" />
8
  <meta name="viewport" content="width=device-width" />
9
  <title>Foundation 4</title>
10

  
11
  <link rel="stylesheet" href="stylesheets/normalize.css" />
12
  
13
  <link rel="stylesheet" href="stylesheets/app.css" />
14
  
15

  
16
  <script src="javascripts/vendor/custom.modernizr.js"></script>
17

  
18
</head>
19
<body>
20
 	<div class="row">
21
 		<p>
22
 			<a href="vm_list_v1.html">VMs list page</a> (kpal original design)<br>
23
 			<a href="testIconFonts/test.html">Sample page for Icon-Font</a>
24
 		</p>
25
 	</div>
26

  
27
  <script>
28
  document.write('<script src=' +
29
  ('__proto__' in {} ? 'javascripts/vendor/zepto' : 'javascripts/vendor/jquery') +
30
  '.js><\/script>')
31
  </script>
32
  
33
  <script src="javascripts/foundation/foundation.js"></script>
34
	
35
	<script src="javascripts/foundation/foundation.alerts.js"></script>
36
	
37
	<script src="javascripts/foundation/foundation.clearing.js"></script>
38
	
39
	<script src="javascripts/foundation/foundation.cookie.js"></script>
40
	
41
	<script src="javascripts/foundation/foundation.dropdown.js"></script>
42
	
43
	<script src="javascripts/foundation/foundation.forms.js"></script>
44
	
45
	<script src="javascripts/foundation/foundation.joyride.js"></script>
46
	
47
	<script src="javascripts/foundation/foundation.magellan.js"></script>
48
	
49
	<script src="javascripts/foundation/foundation.orbit.js"></script>
50
	
51
	<script src="javascripts/foundation/foundation.placeholder.js"></script>
52
	
53
	<script src="javascripts/foundation/foundation.reveal.js"></script>
54
	
55
	<script src="javascripts/foundation/foundation.section.js"></script>
56
	
57
	<script src="javascripts/foundation/foundation.tooltips.js"></script>
58
	
59
	<script src="javascripts/foundation/foundation.topbar.js"></script>
60
	
61
  
62
  <script>
63
    $(document).foundation();
64
  </script>
65
</body>
66
</html>
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js
1
ui = {};
2

  
3
ui.snf = function(closeEl, divToCloseClass) {
4
	closeEl.click(function(e){
5
		e.preventDefault();
6
		$(this).parents(divToCloseClass).slideUp('slow');
7
	});
8
}
9

  
10
$(document).ready(function(){
11

  
12
	ui.snf($('.info .close'), '.info');
13
	ui.snf($('.dummy-navigation .close'), '.dummy-navigation');
14

  
15
	$('.dummy-navigation .our').click(function(e){
16
		e.preventDefault();
17
		$('.ours.'+$(this).data('our')).toggle();
18
		$(this).toggleClass('open');
19
	})
20

  
21
})
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/foundation/foundation.alerts.js
1
/*jslint unparam: true, browser: true, indent: 2 */
2

  
3
;(function ($, window, document, undefined) {
4
  'use strict';
5

  
6
  Foundation.libs.alerts = {
7
    name : 'alerts',
8

  
9
    version : '4.0.0',
10

  
11
    settings : {
12
      speed: 300, // fade out speed
13
      callback: function (){}
14
    },
15

  
16
    init : function (scope, method, options) {
17
      this.scope = scope || this.scope;
18

  
19
      if (typeof method === 'object') {
20
        $.extend(true, this.settings, method);
21
      }
22

  
23
      if (typeof method != 'string') {
24
        if (!this.settings.init) this.events();
25

  
26
        return this.settings.init;
27
      } else {
28
        return this[method].call(this, options);
29
      }
30
    },
31

  
32
    events : function () {
33
      var self = this;
34

  
35
      $(this.scope).on('click.fndtn.alerts', '[data-alert] a.close', function (e) {
36
        e.preventDefault();
37
        $(this).closest("[data-alert]").fadeOut(self.speed, function () {
38
          $(this).remove();
39
          self.settings.callback();
40
        });
41
      });
42

  
43
      this.settings.init = true;
44
    },
45

  
46
    off : function () {
47
      $(this.scope).off('.fndtn.alerts');
48
    }
49
  };
50
}(Foundation.zj, this, this.document));
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/foundation/foundation.clearing.js
1
/*jslint unparam: true, browser: true, indent: 2 */
2

  
3
;(function ($, window, document, undefined) {
4
  'use strict';
5

  
6
  Foundation.libs.clearing = {
7
    name : 'clearing',
8

  
9
    version : '4.0.0',
10

  
11
    settings : {
12
      templates : {
13
        viewing : '<a href="#" class="clearing-close">&times;</a>' +
14
          '<div class="visible-img" style="display: none"><img src="//:0">' +
15
          '<p class="clearing-caption"></p><a href="#" class="clearing-main-left"><span></span></a>' +
16
          '<a href="#" class="clearing-main-right"><span></span></a></div>'
17
      },
18

  
19
      // comma delimited list of selectors that, on click, will close clearing,
20
      // add 'div.clearing-blackout, div.visible-img' to close on background click
21
      close_selectors : '.clearing-close',
22

  
23
      // event initializers and locks
24
      init : false,
25
      locked : false
26
    },
27

  
28
    init : function (scope, method, options) {
29
      this.scope = this.scope || scope;
30
      Foundation.inherit(this, 'set_data get_data remove_data throttle');
31

  
32
      if (typeof method === 'object') {
33
        options = $.extend(true, this.settings, method);
34
      }
35

  
36
      if (typeof method != 'string') {
37
        $(this.scope).find('ul[data-clearing]').each(function () {
38
          var self = Foundation.libs.clearing,
39
              $el = $(this),
40
              options = options || {},
41
              settings = self.get_data($el);
42

  
43
          if (!settings) {
44
            options.$parent = $el.parent();
45

  
46
            self.set_data($el, $.extend(true, self.settings, options));
47

  
48
            self.assemble($el.find('li'));
49

  
50
            if (!self.settings.init) {
51
              self.events().swipe_events();
52
            }
53
          }
54
        });
55

  
56
        return this.settings.init;
57
      } else {
58
        // fire method
59
        return this[method].call(this, options);
60
      }
61
    },
62

  
63
    // event binding and initial setup
64

  
65
    events : function () {
66
      var self = this;
67

  
68
      $(this.scope)
69
        .on('click.fndtn.clearing', 'ul[data-clearing] li',
70
          function (e, current, target) {
71
            var current = current || $(this),
72
                target = target || current,
73
                settings = self.get_data(current.parent());
74

  
75
            e.preventDefault();
76
            if (!settings) self.init();
77

  
78
            // set current and target to the clicked li if not otherwise defined.
79
            self.open($(e.target), current, target);
80
            self.update_paddles(target);
81
          })
82

  
83
        .on('click.fndtn.clearing', '.clearing-main-right',
84
          function (e) { this.nav(e, 'next') }.bind(this))
85
        .on('click.fndtn.clearing', '.clearing-main-left',
86
          function (e) { this.nav(e, 'prev') }.bind(this))
87
        .on('click.fndtn.clearing', this.settings.close_selectors,
88
          function (e) { Foundation.libs.clearing.close(e, this) })
89
        .on('keydown.fndtn.clearing',
90
          function (e) { this.keydown(e) }.bind(this));
91

  
92
      $(window).on('resize.fndtn.clearing',
93
        function (e) { this.resize() }.bind(this));
94

  
95
      this.settings.init = true;
96
      return this;
97
    },
98

  
99
    swipe_events : function () {
100
      var self = this;
101

  
102
      $(this.scope)
103
        .on('touchstart.fndtn.clearing', '.visible-img', function(e) {
104
          if (!e.touches) { e = e.originalEvent; }
105
          var data = {
106
                start_page_x: e.touches[0].pageX,
107
                start_page_y: e.touches[0].pageY,
108
                start_time: (new Date()).getTime(),
109
                delta_x: 0,
110
                is_scrolling: undefined
111
              };
112

  
113
          $(this).data('swipe-transition', data);
114
          e.stopPropagation();
115
        })
116
        .on('touchmove.fndtn.clearing', '.visible-img', function(e) {
117
          if (!e.touches) { e = e.originalEvent; }
118
          // Ignore pinch/zoom events
119
          if(e.touches.length > 1 || e.scale && e.scale !== 1) return;
120

  
121
          var data = $(this).data('swipe-transition');
122

  
123
          if (typeof data === 'undefined') {
124
            data = {};
125
          }
126

  
127
          data.delta_x = e.touches[0].pageX - data.start_page_x;
128

  
129
          if ( typeof data.is_scrolling === 'undefined') {
130
            data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
131
          }
132

  
133
          if (!data.is_scrolling && !data.active) {
134
            e.preventDefault();
135
            var direction = (data.delta_x < 0) ? 'next' : 'prev';
136
            data.active = true;
137
            self.nav(e, direction);
138
          }
139
        })
140
        .on('touchend.fndtn.clearing', '.visible-img', function(e) {
141
          $(this).data('swipe-transition', {});
142
          e.stopPropagation();
143
        });
144
    },
145

  
146
    assemble : function ($li) {
147
      var $el = $li.parent(),
148
          settings = this.get_data($el),
149
          grid = $el.detach(),
150
          data = {
151
            grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',
152
            viewing: settings.templates.viewing
153
          },
154
          wrapper = '<div class="clearing-assembled"><div>' + data.viewing +
155
            data.grid + '</div></div>';
156

  
157
      return settings.$parent.append(wrapper);
158
    },
159

  
160
    // event callbacks
161

  
162
    open : function ($image, current, target) {
163
      var root = target.closest('.clearing-assembled'),
164
          container = root.find('div').first(),
165
          visible_image = container.find('.visible-img'),
166
          image = visible_image.find('img').not($image);
167

  
168
      if (!this.locked()) {
169
        // set the image to the selected thumbnail
170
        image.attr('src', this.load($image));
171

  
172
        this.loaded(image, function () {
173
          // toggle the gallery
174
          root.addClass('clearing-blackout');
175
          container.addClass('clearing-container');
176
          visible_image.show();
177
          this.fix_height(target)
178
            .caption(visible_image.find('.clearing-caption'), $image)
179
            .center(image)
180
            .shift(current, target, function () {
181
              target.siblings().removeClass('visible');
182
              target.addClass('visible');
183
            });
184
        }.bind(this));
185
      }
186
    },
187

  
188
    close : function (e, el) {
189
      e.preventDefault();
190

  
191
      var root = (function (target) {
192
            if (/blackout/.test(target.selector)) {
193
              return target;
194
            } else {
195
              return target.closest('.clearing-blackout');
196
            }
197
          }($(el))), container, visible_image;
198

  
199
      if (el === e.target && root) {
200
        container = root.find('div').first(),
201
        visible_image = container.find('.visible-img');
202
        this.settings.prev_index = 0;
203
        root.find('ul[data-clearing]')
204
          .attr('style', '').closest('.clearing-blackout')
205
          .removeClass('clearing-blackout');
206
        container.removeClass('clearing-container');
207
        visible_image.hide();
208
      }
209

  
210
      return false;
211
    },
212

  
213
    keydown : function (e) {
214
      var clearing = $('.clearing-blackout').find('ul[data-clearing]');
215

  
216
      if (e.which === 39) this.go(clearing, 'next');
217
      if (e.which === 37) this.go(clearing, 'prev');
218
      if (e.which === 27) $('a.clearing-close').trigger('click');
219
    },
220

  
221
    nav : function (e, direction) {
222
      var clearing = $('.clearing-blackout').find('ul[data-clearing]');
223

  
224
      e.preventDefault();
225
      this.go(clearing, direction);
226
    },
227

  
228
    resize : function () {
229
      var image = $('.clearing-blackout .visible-img').find('img');
230

  
231
      if (image.length) {
232
        this.center(image);
233
      }
234
    },
235

  
236
    // visual adjustments
237
    fix_height : function (target) {
238
      var lis = target.parent().children(),
239
          self = this;
240

  
241
      lis.each(function () {
242
          var li = $(this),
243
              image = li.find('img');
244

  
245
          if (li.height() > self.outerHeight(image)) {
246
            li.addClass('fix-height');
247
          }
248
        })
249
        .closest('ul')
250
        .width(lis.length * 100 + '%');
251

  
252
      return this;
253
    },
254

  
255
    update_paddles : function (target) {
256
      var visible_image = target
257
        .closest('.carousel')
258
        .siblings('.visible-img');
259

  
260
      if (target.next().length) {
261
        visible_image
262
          .find('.clearing-main-right')
263
          .removeClass('disabled');
264
      } else {
265
        visible_image
266
          .find('.clearing-main-right')
267
          .addClass('disabled');
268
      }
269

  
270
      if (target.prev().length) {
271
        visible_image
272
          .find('.clearing-main-left')
273
          .removeClass('disabled');
274
      } else {
275
        visible_image
276
          .find('.clearing-main-left')
277
          .addClass('disabled');
278
      }
279
    },
280

  
281
    center : function (target) {
282
      target.css({
283
        marginLeft : -(this.outerWidth(target) / 2),
284
        marginTop : -(this.outerHeight(target) / 2)
285
      });
286
      return this;
287
    },
288

  
289
    // image loading and preloading
290

  
291
    load : function ($image) {
292
      var href = $image.parent().attr('href');
293

  
294
      this.preload($image);
295

  
296
      if (href) return href;
297
      return $image.attr('src');
298
    },
299

  
300
    preload : function ($image) {
301
      this
302
        .img($image.closest('li').next())
303
        .img($image.closest('li').prev());
304
    },
305

  
306
    loaded : function (image, callback) {
307
      // based on jquery.imageready.js
308
      // @weblinc, @jsantell, (c) 2012
309

  
310
      function loaded () {
311
        callback();
312
      }
313

  
314
      function bindLoad () {
315
        this.one('load', loaded);
316

  
317
        if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
318
          var src = this.attr( 'src' ),
319
              param = src.match( /\?/ ) ? '&' : '?';
320

  
321
          param += 'random=' + (new Date()).getTime();
322
          this.attr('src', src + param);
323
        }
324
      }
325

  
326
      if (!image.attr('src')) {
327
        loaded();
328
        return;
329
      }
330

  
331
      if (this.complete || this.readyState === 4) {
332
        loaded();
333
      } else {
334
        bindLoad.call(image);
335
      }
336
    },
337

  
338
    img : function (img) {
339
      if (img.length) {
340
        var new_img = new Image(),
341
            new_a = img.find('a');
342

  
343
        if (new_a.length) {
344
          new_img.src = new_a.attr('href');
345
        } else {
346
          new_img.src = img.find('img').attr('src');
347
        }
348
      }
349
      return this;
350
    },
351

  
352
    // image caption
353

  
354
    caption : function (container, $image) {
355
      var caption = $image.data('caption');
356

  
357
      if (caption) {
358
        container
359
          .text(caption)
360
          .show();
361
      } else {
362
        container
363
          .text('')
364
          .hide();
365
      }
366
      return this;
367
    },
368

  
369
    // directional methods
370

  
371
    go : function ($ul, direction) {
372
      var current = $ul.find('.visible'),
373
          target = current[direction]();
374

  
375
      if (target.length) {
376
        target
377
          .find('img')
378
          .trigger('click', [current, target]);
379
      }
380
    },
381

  
382
    shift : function (current, target, callback) {
383
      var clearing = target.parent(),
384
          old_index = this.settings.prev_index || target.index(),
385
          direction = this.direction(clearing, current, target),
386
          left = parseInt(clearing.css('left'), 10),
387
          width = this.outerWidth(target),
388
          skip_shift;
389

  
390
      // we use jQuery animate instead of CSS transitions because we
391
      // need a callback to unlock the next animation
392
      if (target.index() !== old_index && !/skip/.test(direction)){
393
        if (/left/.test(direction)) {
394
          this.lock();
395
          clearing.animate({left : left + width}, 300, this.unlock());
396
        } else if (/right/.test(direction)) {
397
          this.lock();
398
          clearing.animate({left : left - width}, 300, this.unlock());
399
        }
400
      } else if (/skip/.test(direction)) {
401
        // the target image is not adjacent to the current image, so
402
        // do we scroll right or not
403
        skip_shift = target.index() - this.settings.up_count;
404
        this.lock();
405

  
406
        if (skip_shift > 0) {
407
          clearing.animate({left : -(skip_shift * width)}, 300, this.unlock());
408
        } else {
409
          clearing.animate({left : 0}, 300, this.unlock());
410
        }
411
      }
412

  
413
      callback();
414
    },
415

  
416
    direction : function ($el, current, target) {
417
      var lis = $el.find('li'),
418
          li_width = this.outerWidth(lis) + (this.outerWidth(lis) / 4),
419
          up_count = Math.floor(this.outerWidth($('.clearing-container')) / li_width) - 1,
420
          target_index = lis.index(target),
421
          response;
422

  
423
      this.settings.up_count = up_count;
424

  
425
      if (this.adjacent(this.settings.prev_index, target_index)) {
426
        if ((target_index > up_count)
427
          && target_index > this.settings.prev_index) {
428
          response = 'right';
429
        } else if ((target_index > up_count - 1)
430
          && target_index <= this.settings.prev_index) {
431
          response = 'left';
432
        } else {
433
          response = false;
434
        }
435
      } else {
436
        response = 'skip';
437
      }
438

  
439
      this.settings.prev_index = target_index;
440

  
441
      return response;
442
    },
443

  
444
    adjacent : function (current_index, target_index) {
445
      for (var i = target_index + 1; i >= target_index - 1; i--) {
446
        if (i === current_index) return true;
447
      }
448
      return false;
449
    },
450

  
451
    // lock management
452

  
453
    lock : function () {
454
      this.settings.locked = true;
455
    },
456

  
457
    unlock : function () {
458
      this.settings.locked = false;
459
    },
460

  
461
    locked : function () {
462
      return this.settings.locked;
463
    },
464

  
465
    // plugin management/browser quirks
466

  
467
    outerHTML : function (el) {
468
      // support FireFox < 11
469
      return el.outerHTML || new XMLSerializer().serializeToString(el);
470
    },
471

  
472
    off : function () {
473
      $(this.scope).off('.fndtn.clearing');
474
      $(window).off('.fndtn.clearing');
475
      this.remove_data(); // empty settings cache
476
      this.settings.init = false;
477
    }
478
  };
479

  
480
}(Foundation.zj, this, this.document));
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/foundation/foundation.cookie.js
1
/*!
2
 * jQuery Cookie Plugin v1.3
3
 * https://github.com/carhartl/jquery-cookie
4
 *
5
 * Copyright 2011, Klaus Hartl
6
 * Dual licensed under the MIT or GPL Version 2 licenses.
7
 * http://www.opensource.org/licenses/mit-license.php
8
 * http://www.opensource.org/licenses/GPL-2.0
9
 *
10
 * Modified to work with Zepto.js by ZURB
11
 */
12
(function ($, document, undefined) {
13

  
14
  var pluses = /\+/g;
15

  
16
  function raw(s) {
17
    return s;
18
  }
19

  
20
  function decoded(s) {
21
    return decodeURIComponent(s.replace(pluses, ' '));
22
  }
23

  
24
  var config = $.cookie = function (key, value, options) {
25

  
26
    // write
27
    if (value !== undefined) {
28
      options = $.extend({}, config.defaults, options);
29

  
30
      if (value === null) {
31
        options.expires = -1;
32
      }
33

  
34
      if (typeof options.expires === 'number') {
35
        var days = options.expires, t = options.expires = new Date();
36
        t.setDate(t.getDate() + days);
37
      }
38

  
39
      value = config.json ? JSON.stringify(value) : String(value);
40

  
41
      return (document.cookie = [
42
        encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
43
        options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
44
        options.path    ? '; path=' + options.path : '',
45
        options.domain  ? '; domain=' + options.domain : '',
46
        options.secure  ? '; secure' : ''
47
      ].join(''));
48
    }
49

  
50
    // read
51
    var decode = config.raw ? raw : decoded;
52
    var cookies = document.cookie.split('; ');
53
    for (var i = 0, l = cookies.length; i < l; i++) {
54
      var parts = cookies[i].split('=');
55
      if (decode(parts.shift()) === key) {
56
        var cookie = decode(parts.join('='));
57
        return config.json ? JSON.parse(cookie) : cookie;
58
      }
59
    }
60

  
61
    return null;
62
  };
63

  
64
  config.defaults = {};
65

  
66
  $.removeCookie = function (key, options) {
67
    if ($.cookie(key) !== null) {
68
      $.cookie(key, null, options);
69
      return true;
70
    }
71
    return false;
72
  };
73

  
74
})(Foundation.zj, document);
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/foundation/foundation.dropdown.js
1
/*jslint unparam: true, browser: true, indent: 2 */
2

  
3
;(function ($, window, document, undefined) {
4
  'use strict';
5

  
6
  Foundation.libs.dropdown = {
7
    name : 'dropdown',
8

  
9
    version : '4.0.9',
10

  
11
    settings : {
12
      activeClass: 'open'
13
    },
14

  
15
    init : function (scope, method, options) {
16
      this.scope = scope || this.scope;
17
      Foundation.inherit(this, 'throttle');
18

  
19
      if (typeof method === 'object') {
20
        $.extend(true, this.settings, method);
21
      }
22

  
23
      if (typeof method != 'string') {
24

  
25
        if (!this.settings.init) {
26
          this.events();
27
        }
28

  
29
        return this.settings.init;
30
      } else {
31
        return this[method].call(this, options);
32
      }
33
    },
34

  
35
    events : function () {
36
      var self = this;
37

  
38
      $(this.scope).on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
39
        e.preventDefault();
40
        e.stopPropagation();
41
        self.toggle($(this));
42
      });
43

  
44
      $('*, html, body').on('click.fndtn.dropdown', function (e) {
45
        if (!$(e.target).data('dropdown')) {
46
          $('[data-dropdown-content]')
47
            .css('left', '-99999px')
48
            .removeClass(self.settings.activeClass);
49
        }
50
      });
51

  
52
      $(window).on('resize.fndtn.dropdown', self.throttle(function () {
53
        self.resize.call(self);
54
      }, 50)).trigger('resize');
55

  
56
      this.settings.init = true;
57
    },
58

  
59
    toggle : function (target, resize) {
60
      var dropdown = $('#' + target.data('dropdown'));
61

  
62
      $('[data-dropdown-content]').not(dropdown).css('left', '-99999px').removeClass(this.settings.activeClass);
63

  
64
      if (dropdown.hasClass(this.settings.activeClass)) {
65
        dropdown
66
          .css('left', '-99999px')
67
          .removeClass(this.settings.activeClass);
68
      } else {
69
        this
70
          .css(dropdown
71
            .addClass(this.settings.activeClass), target);
72
      }
73
    },
74

  
75
    resize : function () {
76
      var dropdown = $('[data-dropdown-content].open'),
77
          target = $("[data-dropdown='" + dropdown.attr('id') + "']");
78

  
79
      if (dropdown.length && target.length) {
80
        this.css(dropdown, target);
81
      }
82
    },
83

  
84
    css : function (dropdown, target) {
85
      if (dropdown.parent()[0] === $('body')[0]) {
86
        var position = target.offset();
87
      } else {
88
        var position = target.position();
89
      }
90

  
91
      if (this.small()) {
92
        dropdown.css({
93
          position : 'absolute',
94
          width: '95%',
95
          left: '2.5%',
96
          'max-width': 'none',
97
          top: position.top + this.outerHeight(target)
98
        });
99
      } else {
100
        if ($(window).width() > this.outerWidth(dropdown) + target.offset().left) {
101
          var left = position.left;
102
        } else {
103
          if (!dropdown.hasClass('right')) {
104
            dropdown.addClass('right');
105
          }
106
          var left = position.left - (this.outerWidth(dropdown) - this.outerWidth(target));
107
        }
108
        dropdown.attr('style', '').css({
109
          position : 'absolute',
110
          top: position.top + this.outerHeight(target),
111
          left: left
112
        });
113
      }
114

  
115
      return dropdown;
116
    },
117

  
118
    small : function () {
119
      return $(window).width() < 768 || $('html').hasClass('lt-ie9');
120
    },
121

  
122
    off: function () {
123
      $(this.scope).off('.fndtn.dropdown');
124
      $('html, body').off('.fndtn.dropdown');
125
      $(window).off('.fndtn.dropdown');
126
      $('[data-dropdown-content]').off('.fndtn.dropdown');
127
      this.settings.init = false;
128
    }
129
  };
130
}(Foundation.zj, this, this.document));
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/foundation/foundation.forms.js
1
/*jslint unparam: true, browser: true, indent: 2 */
2

  
3
;(function ($, window, document, undefined) {
4
  'use strict';
5

  
6
  Foundation.libs.forms = {
7
    name : 'forms',
8

  
9
    version : '4.0.4',
10

  
11
    settings : {
12
      disable_class: 'no-custom'
13
    },
14

  
15
    init : function (scope, method, options) {
16
      this.scope = scope || this.scope;
17

  
18
      if (typeof method === 'object') {
19
        $.extend(true, this.settings, method);
20
      }
21

  
22
      if (typeof method != 'string') {
23
        if (!this.settings.init) {
24
          this.events();
25
        }
26

  
27
        this.assemble();
28

  
29
        return this.settings.init;
30
      } else {
31
        return this[method].call(this, options);
32
      }
33
    },
34

  
35
    assemble : function () {
36
      $('form.custom input[type="radio"]', $(this.scope)).not('[data-customforms="disabled"]')
37
        .each(this.append_custom_markup);
38
      $('form.custom input[type="checkbox"]', $(this.scope)).not('[data-customforms="disabled"]')
39
        .each(this.append_custom_markup);
40
      $('form.custom select', $(this.scope)).not('[data-customforms="disabled"]')
41
        .each(this.append_custom_select);
42
    },
43

  
44
    events : function () {
45
      var self = this;
46

  
47
      $(this.scope)
48
        .on('change.fndtn.forms', 'form.custom select:not([data-customforms="disabled"])', function (e) {
49
          self.refresh_custom_select($(this));
50
        })
51
        .on('click.fndtn.forms', 'form.custom label', function (e) {
52
          var $associatedElement = $('#' + self.escape($(this).attr('for')) + ':not([data-customforms="disabled"])'),
53
              $customCheckbox,
54
              $customRadio;
55
          if ($associatedElement.length !== 0) {
56
            if ($associatedElement.attr('type') === 'checkbox') {
57
              e.preventDefault();
58
              $customCheckbox = $(this).find('span.custom.checkbox');
59

  
60
              //the checkbox might be outside after the label
61
              if ($customCheckbox.length == 0) {
62
                $customCheckbox = $(this).next('span.custom.checkbox');
63
              }
64
              //the checkbox might be outside before the label
65
              if ($customCheckbox.length == 0) {
66
                $customCheckbox = $(this).prev('span.custom.checkbox');
67
              }
68
              self.toggle_checkbox($customCheckbox);
69
            } else if ($associatedElement.attr('type') === 'radio') {
70
              e.preventDefault();
71
              $customRadio = $(this).find('span.custom.radio');
72
              //the radio might be outside after the label
73
              if ($customRadio.length == 0) {
74
                $customRadio = $(this).next('span.custom.radio');
75
              }
76
              //the radio might be outside before the label
77
              if ($customRadio.length == 0) {
78
                $customRadio = $(this).prev('span.custom.radio');
79
              }
80
              self.toggle_radio($customRadio);
81
            }
82
          }
83
        })
84
        .on('click.fndtn.forms', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (e) {
85
          var $this = $(this),
86
              $dropdown = $this.closest('div.custom.dropdown'),
87
              $select = $dropdown.prev();
88

  
89
          // make sure other dropdowns close
90
          if(!$dropdown.hasClass('open'))
91
            $(self.scope).trigger('click');
92

  
93
          e.preventDefault();
94
          if (false === $select.is(':disabled')) {
95
            $dropdown.toggleClass('open');
96

  
97
            if ($dropdown.hasClass('open')) {
98
              $(self.scope).on('click.fndtn.forms.customdropdown', function () {
99
                $dropdown.removeClass('open');
100
                $(self.scope).off('.fndtn.forms.customdropdown');
101
              });
102
            } else {
103
              $(self.scope).on('.fndtn.forms.customdropdown');
104
            }
105
            return false;
106
          }
107
        })
108
        .on('click.fndtn.forms touchend.fndtn.forms', 'form.custom div.custom.dropdown li', function (e) {
109
          var $this = $(this),
110
              $customDropdown = $this.closest('div.custom.dropdown'),
111
              $select = $customDropdown.prev(),
112
              selectedIndex = 0;
113

  
114
          e.preventDefault();
115
          e.stopPropagation();
116

  
117
          if ( ! $(this).hasClass('disabled')) {
118
            $('div.dropdown').not($customDropdown).removeClass('open');
119

  
120
            var $oldThis= $this
121
              .closest('ul')
122
              .find('li.selected');
123
            $oldThis.removeClass('selected');
124

  
125
            $this.addClass('selected');
126

  
127
            $customDropdown
128
              .removeClass('open')
129
              .find('a.current')
130
              .html($this.html());
131

  
132
            $this.closest('ul').find('li').each(function (index) {
133
              if ($this[0] == this) {
134
                selectedIndex = index;
135
              }
136

  
137
            });
138
            $select[0].selectedIndex = selectedIndex;
139

  
140
            //store the old value in data
141
            $select.data('prevalue', $oldThis.html());
142
            $select.trigger('change');
143
          }
144
        });
145

  
146
      this.settings.init = true;
147
    },
148

  
149
    append_custom_markup : function (idx, sel) {
150
      var $this = $(sel).hide(),
151
          type  = $this.attr('type'),
152
          $span = $this.next('span.custom.' + type);
153

  
154
      if ($span.length === 0) {
155
        $span = $('<span class="custom ' + type + '"></span>').insertAfter($this);
156
      }
157

  
158
      $span.toggleClass('checked', $this.is(':checked'));
159
      $span.toggleClass('disabled', $this.is(':disabled'));
160
    },
161

  
162
    append_custom_select : function (idx, sel) {
163
      var self = Foundation.libs.forms,
164
          $this = $( sel ),
165
          $customSelect = $this.next( 'div.custom.dropdown' ),
166
          $customList = $customSelect.find( 'ul' ),
167
          $selectCurrent = $customSelect.find( ".current" ),
168
          $selector = $customSelect.find( ".selector" ),
169
          $options = $this.find( 'option' ),
170
          $selectedOption = $options.filter( ':selected' ),
171
          copyClasses = $this.attr('class') ? $this.attr('class').split(' ') : [],
172
          maxWidth = 0,
173
          liHtml = '',
174
          $listItems,
175
          $currentSelect = false;
176

  
177
      if ($this.hasClass(self.settings.disable_class)) return;
178

  
179
      if ($customSelect.length === 0) {
180
        var customSelectSize = $this.hasClass( 'small' )   ? 'small'   :
181
                               $this.hasClass( 'medium' )  ? 'medium'  :
182
                               $this.hasClass( 'large' )   ? 'large'   :
183
                               $this.hasClass( 'expand' )  ? 'expand'  : '';
184

  
185
        $customSelect = $('<div class="' + ['custom', 'dropdown', customSelectSize ].concat(copyClasses).filter(function(item, idx,arr){ if(item == '') return false; return arr.indexOf(item) == idx; }).join( ' ' ) + '"><a href="#" class="selector"></a><ul /></div>');
186
        $selector = $customSelect.find(".selector");
187
        $customList = $customSelect.find("ul");
188
        liHtml = $options.map(function() { return "<li>" + $( this ).html() + "</li>"; } ).get().join( '' );
189
        $customList.append(liHtml);
190
        $currentSelect = $customSelect.prepend('<a href="#" class="current">' + $selectedOption.html() + '</a>' ).find( ".current" );
191
        $this
192
          .after( $customSelect )
193
          .hide();
194

  
195
      } else {
196
        liHtml = $options.map(function() {
197
            return "<li>" + $( this ).html() + "</li>";
198
          })
199
          .get().join('');
200
        $customList
201
          .html('')
202
          .append(liHtml);
203

  
204
      } // endif $customSelect.length === 0
205
      $customSelect.toggleClass('disabled', $this.is( ':disabled' ) );
206
      $listItems = $customList.find( 'li' );
207

  
208
      $options.each( function ( index ) {
209
        if ( this.selected ) {
210
          $listItems.eq( index ).addClass( 'selected' );
211

  
212
          if ($currentSelect) {
213
            $currentSelect.html( $( this ).html() );
214
          }
215

  
216
        }
217
        if ($(this).is(':disabled')) {
218
          $listItems.eq( index ).addClass( 'disabled' );
219
        }
220
      });
221

  
222
      //
223
      // If we're not specifying a predetermined form size.
224
      //
225
      if (!$customSelect.is('.small, .medium, .large, .expand')) {
226

  
227
        // ------------------------------------------------------------------------------------
228
        // This is a work-around for when elements are contained within hidden parents.
229
        // For example, when custom-form elements are inside of a hidden reveal modal.
230
        //
231
        // We need to display the current custom list element as well as hidden parent elements
232
        // in order to properly calculate the list item element's width property.
233
        // -------------------------------------------------------------------------------------
234

  
235
        $customSelect.addClass( 'open' );
236
        //
237
        // Quickly, display all parent elements.
238
        // This should help us calcualate the width of the list item's within the drop down.
239
        //
240
        var self = Foundation.libs.forms;
241
        self.hidden_fix.adjust( $customList );
242

  
243
        maxWidth = ( self.outerWidth($listItems) > maxWidth ) ? self.outerWidth($listItems) : maxWidth;
244

  
245
        Foundation.libs.forms.hidden_fix.reset();
246

  
247
        $customSelect.removeClass( 'open' );
248

  
249
      } // endif
250

  
251
    },
252

  
253
    refresh_custom_select : function ($select) {
254
      var self = this;
255
      var maxWidth = 0,
256
        $customSelect = $select.next(),
257
        $options = $select.find('option');
258

  
259
      $customSelect.find('ul').html('');
260

  
261
      $options.each(function () {
262
        var $li = $('<li>' + $(this).html() + '</li>');
263
        $customSelect.find('ul').append($li);
264
      });
265

  
266
      // re-populate
267
      $options.each(function (index) {
268
        if (this.selected) {
269
          $customSelect.find('li').eq(index).addClass('selected');
270
          $customSelect.find('.current').html($(this).html());
271
        }
272
        if ($(this).is(':disabled')) {
273
          $customSelect.find('li').eq(index).addClass('disabled');
274
        }
275
      });
276

  
277
      // fix width
278
      $customSelect.removeAttr('style')
279
        .find('ul').removeAttr('style');
280
      $customSelect.find('li').each(function () {
281
        $customSelect.addClass('open');
282
        if (self.outerWidth($(this)) > maxWidth) {
283
          maxWidth = self.outerWidth($(this));
284
        }
285
        $customSelect.removeClass('open');
286
      });
287
    },
288

  
289
    toggle_checkbox : function ($element) {
290
      var $input = $element.prev(),
291
          input = $input[0];
292

  
293
      if (false === $input.is(':disabled')) {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff