aslon_mobile2 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in aslon_mobile2.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 aslon
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1 @@
1
+ This file was created by JetBrains RubyMine 5.0 for binding GitHub repository
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # AslonMobile2
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'aslon_mobile2'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install aslon_mobile2
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,8 @@
1
+ /*
2
+ * jQuery Mobile Framework : plugin to provide a simple Dialog widget.
3
+ * Copyright (c) JTSage
4
+ * CC 3.0 Attribution. May be relicensed without permission/notifcation.
5
+ * https://github.com/jtsage/jquery-mobile-simpledialog
6
+ */
7
+
8
+ (function(a,b){a.widget("mobile.simpledialog2",a.mobile.widget,{options:{version:"1.0.1-2012022700",mode:"blank",themeDialog:"b",themeInput:false,themeButtonDefault:false,themeHeader:"a",fullScreen:false,fullScreenForce:false,dialogAllow:false,dialogForce:false,headerText:false,headerClose:false,buttonPrompt:false,buttonInput:false,buttonPassword:false,blankContent:false,resizeListener:true,safeNuke:true,forceInput:true,showModal:true,animate:true,transition:"pop",clickEvent:"click",zindex:"500",width:"280px",left:false,top:false,callbackOpen:false,callbackOpenArgs:[],callbackClose:false,callbackCloseArgs:[]},_eventHandler:function(f,d){var c=f.data.widget,g=f.data.widget.options;if(!f.isPropagationStopped()){switch(d.method){case"close":c.close();break;case"html":c.updateBlank(d.source);break}}},_create:function(){var c=this,f=a.extend(this.options,this.element.jqmData("options")),e=new Date(),d=a("<div class='ui-simpledialog-container ui-overlay-shadow ui-corner-all ui-simpledialog-hidden "+((f.animate===true)?f.transition:"")+" ui-body-"+f.themeDialog+"'></div>");if(f.themeButtonDefault===false){f.themeButtonDefault=f.themeDialog}if(f.themeInput===false){f.themeInput=f.themeDialog}a.mobile.sdCurrentDialog=c;if(typeof a.mobile.sdLastInput!=="undefined"){delete a.mobile.sdLastInput}c.internalID=e.getTime();c.displayAnchor=a.mobile.activePage.children(".ui-content").first();c.dialogPage=a("<div data-role='dialog' class='ui-simpledialog-dialog' data-theme='"+f.themeDialog+"'><div data-role='header'></div><div data-role='content'></div></div>");c.sdAllContent=c.dialogPage.find("[data-role=content]");d.appendTo(c.sdAllContent);c.sdIntContent=c.sdAllContent.find(".ui-simpledialog-container");c.sdIntContent.css("width",f.width);if(f.headerText!==false||f.headerClose!==false){c.sdHeader=a('<div style="margin-bottom: 4px;" class="ui-header ui-bar-'+f.themeHeader+'"></div>');if(f.headerClose===true){a("<a class='ui-btn-left' rel='close' href='#'>Close</a>").appendTo(c.sdHeader).buttonMarkup({theme:f.themeHeader,icon:"delete",iconpos:"notext",corners:true,shadow:true})}a('<h1 class="ui-title">'+((f.headerText!==false)?f.headerText:"")+"</h1>").appendTo(c.sdHeader);c.sdHeader.appendTo(c.sdIntContent)}if(f.mode==="blank"){if(f.blankContent===true){f.blankContent=c.element.html()}a(f.blankContent).appendTo(c.sdIntContent)}else{if(f.mode==="button"){c._makeButtons().appendTo(c.sdIntContent)}}c.sdIntContent.appendTo(c.displayAnchor.parent());c.dialogPage.appendTo(a.mobile.pageContainer).page().css("minHeight","0px").css("zIndex",f.zindex);if(f.animate===true){c.dialogPage.addClass(f.transition)}c.screen=a("<div>",{"class":"ui-simpledialog-screen ui-simpledialog-hidden"}).css("z-index",(f.zindex-1)).appendTo(c.displayAnchor.parent()).bind(f.clickEvent,function(g){if(!f.forceInput){c.close()}g.preventDefault()});if(f.showModal){c.screen.addClass("ui-simpledialog-screen-modal")}a(document).bind("simpledialog."+c.internalID,{widget:c},function(h,g){c._eventHandler(h,g)})},_makeButtons:function(){var d=this,g=d.options,f=a("<div></div>"),e=a("<div class='ui-simpledialog-controls'><input class='ui-simpledialog-input ui-input-text ui-shadow-inset ui-corner-all ui-body-"+g.themeInput+"' type='"+((g.buttonPassword===true)?"password":"text")+"' name='pickin' /></div>"),c=a("<div>",{"class":"ui-simpledialog-controls"});if(g.buttonPrompt!==false){d.buttonPromptText=a("<p class='ui-simpledialog-subtitle'>"+g.buttonPrompt+"</p>").appendTo(f)}if(g.buttonInput!==false){a.mobile.sdLastInput="";e.appendTo(f);e.find("input").bind("change",function(){a.mobile.sdLastInput=e.find("input").first().val();d.thisInput=e.find("input").first().val()})}c.appendTo(f);d.butObj=[];a.each(g.buttons,function(h,i){i=a.isFunction(i)?{click:i}:i;i=a.extend({text:h,id:h+d.internalID,theme:g.themeButtonDefault,icon:"check",iconpos:"left",corners:"true",shadow:"true",args:[],close:true},i);d.butObj.push(a("<a href='#'>"+h+"</a>").appendTo(c).attr("id",i.id).buttonMarkup({theme:i.theme,icon:i.icon,iconpos:i.iconpos,corners:i.corners,shadow:i.shadow}).unbind("vclick click").bind(g.clickEvent,function(){if(g.buttonInput){d.sdIntContent.find("input [name=pickin]").trigger("change")}var j=i.click.apply(d,a.merge(arguments,i.args));if(j!==false&&i.close===true){d.close()}}))});return f},_getCoords:function(i){var d=i,g=a.mobile.activePage.width(),e=a(window).scrollTop(),f=a(window).height(),c=i.sdIntContent.innerWidth(),j=i.sdIntContent.outerHeight(),h={high:a(window).height(),width:a.mobile.activePage.width(),fullTop:a(window).scrollTop(),fullLeft:a(window).scrollLeft(),winTop:e+((i.options.top!==false)?i.options.top:((f/2)-(j/2))),winLeft:((i.options.left!==false)?i.options.left:((g/2)-(c/2)))};if(h.winTop<45){h.winTop=45}return h},_orientChange:function(f){var c=f.data.widget,g=f.data.widget.options,d=f.data.widget._getCoords(f.data.widget);f.stopPropagation();if(c.isDialog===true){return true}else{if(g.fullScreen===true&&(d.width<400||g.fullScreenForce===true)){c.sdIntContent.css({border:"none",position:"absolute",top:d.fullTop,left:d.fullLeft,height:d.high,width:d.width,maxWidth:d.width}).removeClass("ui-simpledialog-hidden")}else{c.sdIntContent.css({position:"absolute",top:d.winTop,left:d.winLeft}).removeClass("ui-simpledialog-hidden")}}},repos:function(){var c={data:{widget:this},stopPropagation:function(){return true}};this._orientChange(c)},open:function(){var c=this,e=this.options,d=this._getCoords(this);c.sdAllContent.find(".ui-btn-active").removeClass("ui-btn-active");c.sdIntContent.delegate("[rel=close]",e.clickEvent,function(f){f.preventDefault();c.close()});if((e.dialogAllow===true&&d.width<400)||e.dialogForce){c.isDialog=true;if(e.mode==="blank"){c.sdIntContent.find("select").each(function(){a(this).jqmData("nativeMenu",true)})}c.displayAnchor.parent().unbind("pagehide.remove");c.sdAllContent.append(c.sdIntContent);c.sdAllContent.trigger("create");if(e.headerText!==false){c.sdHeader.find("h1").appendTo(c.dialogPage.find("[data-role=header]"));c.sdIntContent.find(".ui-header").empty().removeClass()}if(e.headerClose===true){c.dialogPage.find(".ui-header a").bind("click",function(){setTimeout("$.mobile.sdCurrentDialog.destroy();",1000)})}else{c.dialogPage.find(".ui-header a").remove()}c.sdIntContent.removeClass().css({top:"auto",width:"auto",left:"auto",marginLeft:"auto",marginRight:"auto",zIndex:e.zindex});a.mobile.changePage(c.dialogPage,{transition:(e.animate===true)?e.transition:"none"})}else{c.isDialog=false;c.selects=[];if(e.fullScreen===false){if(e.showModal===true&&e.animate===true){c.screen.fadeIn("slow")}else{c.screen.removeClass("ui-simpledialog-hidden")}}c.sdIntContent.addClass("ui-overlay-shadow in").css("zIndex",e.zindex).trigger("create");if(e.fullScreen===true&&(d.width<400||e.fullScreenForce===true)){c.sdIntContent.removeClass("ui-simpledialog-container").css({border:"none",position:"absolute",top:d.fullTop,left:d.fullLeft,height:d.high,width:d.width,maxWidth:d.width}).removeClass("ui-simpledialog-hidden")}else{c.sdIntContent.css({position:"absolute",top:d.winTop,left:d.winLeft}).removeClass("ui-simpledialog-hidden")}a(document).bind("orientationchange.simpledialog",{widget:c},function(f){c._orientChange(f)});if(e.resizeListener===true){a(window).bind("resize.simpledialog",{widget:c},function(f){c._orientChange(f)})}}if(a.isFunction(e.callbackOpen)){e.callbackOpen.apply(c,e.callbackOpenArgs)}},close:function(){var c=this,d;if(a.isFunction(c.options.callbackClose)){d=c.options.callbackClose.apply(c,c.options.callbackCloseArgs);if(d===false){return false}}if(c.isDialog){a(c.dialogPage).dialog("close");c.sdIntContent.addClass("ui-simpledialog-hidden");c.sdIntContent.appendTo(c.displayAnchor.parent());if(a.mobile.activePage.jqmData("page").options.domCache!=true){a.mobile.activePage.bind("pagehide.remove",function(){a(this).remove()})}}else{if(c.options.showModal===true&&c.options.animate===true){c.screen.fadeOut("slow")}else{c.screen.addClass("ui-simpledialog-hidden")}c.sdIntContent.addClass("ui-simpledialog-hidden").removeClass("in");a(document).unbind("orientationchange.simpledialog");if(c.options.resizeListener===true){a(window).unbind("resize.simpledialog")}}a.mobile.activePage.find(".ui-btn-active").removeClass("ui-btn-active");if(c.isDialog===true||c.options.animate===true){setTimeout("$.mobile.sdCurrentDialog.destroy();",1000)}else{c.destroy()}},destroy:function(){var c=this,d=c.element;if(c.options.mode==="blank"){a.mobile.sdCurrentDialog.sdIntContent.find("select").each(function(){if(a(this).data("nativeMenu")==false){a(this).data("selectmenu").menuPage.remove();a(this).data("selectmenu").screen.remove();a(this).data("selectmenu").listbox.remove()}})}a(c.sdIntContent).remove();a(c.dialogPage).remove();a(c.screen).remove();a(document).unbind("simpledialog."+c.internalID);delete a.mobile.sdCurrentDialog;a.Widget.prototype.destroy.call(c);if(c.options.safeNuke===true&&a(d).parents().length===0&&a(d).contents().length===0){d.remove()}},updateBlank:function(e){var c=this,d=this.options;c.sdIntContent.empty();if(d.headerText!==false||d.headerClose!==false){c.sdHeader=a('<div class="ui-header ui-bar-'+d.themeHeader+'"></div>');if(d.headerClose===true){a("<a class='ui-btn-left' rel='close' href='#'>Close</a>").appendTo(c.sdHeader).buttonMarkup({theme:d.themeHeader,icon:"delete",iconpos:"notext",corners:true,shadow:true})}a('<h1 class="ui-title">'+((d.headerText!==false)?d.headerText:"")+"</h1>").appendTo(c.sdHeader);c.sdHeader.appendTo(c.sdIntContent)}a(e).appendTo(c.sdIntContent);c.sdIntContent.trigger("create");a(document).trigger("orientationchange.simpledialog")},_init:function(){this.open()}})})(jQuery);
@@ -0,0 +1,12 @@
1
+ <script>
2
+ jQuery(function(){
3
+ $('<div>').simpledialog2({
4
+ mode: 'blank',
5
+ headerText: 'Alerte',
6
+ headerClose: true,
7
+ blankContent :
8
+ "<ul data-role='listview'> <%="#{@flash}".html_safe%> </ul> <a rel='close' data-role='button' href='#'>OK</a>"
9
+ })
10
+ }
11
+ )
12
+ </script>
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aslon_mobile2/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "aslon_mobile2"
8
+ gem.version = AslonMobile2::VERSION
9
+ gem.authors = ["aslon"]
10
+ gem.email = [" Write your email address"]
11
+ gem.description = %q{Write a gem description}
12
+ gem.summary = %q{Write a gem summary}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,15 @@
1
+ module ApplicationHelper
2
+ # List of mobile agents, from mobile_fu (https://github.com/brendanlim/mobile-fu)
3
+ #
4
+ MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' +
5
+ 'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' +
6
+ 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' +
7
+ 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' +
8
+ 'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' +
9
+ 'mobile|maemo|fennec'
10
+
11
+ def is_mobile_request?
12
+ request.user_agent.to_s.downcase =~ /#{MOBILE_USER_AGENTS}/
13
+ end
14
+ end
15
+
@@ -0,0 +1,8 @@
1
+ require "aslon_mobile2/version"
2
+
3
+ module AslonMobile2
4
+ # Your code goes here...
5
+ class Engine < Rails::Engine
6
+ #config.mount_at = '/'
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module AslonMobile2
2
+ VERSION = "0.1.1"
3
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aslon_mobile2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - aslon
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-12 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Write a gem description
15
+ email:
16
+ - ! ' Write your email address'
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README
25
+ - README.md
26
+ - Rakefile
27
+ - app/assets/javascripts/jquery.mobile.simpledialog2.min.js
28
+ - app/views/layouts/_alerte_mobile.html.erb
29
+ - aslon_mobile2.gemspec
30
+ - lib/application_helper.rb
31
+ - lib/aslon_mobile2.rb
32
+ - lib/aslon_mobile2/version.rb
33
+ homepage: ''
34
+ licenses: []
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 1.8.25
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: Write a gem summary
57
+ test_files: []