sooner 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.rdoc +0 -0
  3. data/Rakefile +28 -32
  4. data/app/assets/javascripts/sooner/admin/application.js +8 -0
  5. data/app/assets/javascripts/sooner/application.js +2 -0
  6. data/app/assets/javascripts/sooner/jquery.tablesorter.min.js +4 -0
  7. data/app/assets/javascripts/sooner/subscribers.js +2 -0
  8. data/app/assets/stylesheets/sooner/admin/application.css +37 -0
  9. data/app/assets/stylesheets/sooner/application.css +3 -0
  10. data/app/assets/stylesheets/sooner/subscribers.css +0 -0
  11. data/app/controllers/sooner/admin/subscribers_controller.rb +89 -0
  12. data/app/controllers/sooner/application_controller.rb +4 -0
  13. data/app/controllers/sooner/subscribers_controller.rb +20 -16
  14. data/app/helpers/sooner/admin/subscribers_helper.rb +4 -0
  15. data/app/helpers/sooner/application_helper.rb +4 -0
  16. data/app/helpers/sooner/subscribers_helper.rb +4 -0
  17. data/app/mailers/sooner/subscribers_mailer.rb +16 -0
  18. data/app/models/sooner/admin/subscriber.rb +3 -0
  19. data/app/models/sooner/subscriber.rb +19 -12
  20. data/app/views/layouts/sooner/admin.html.erb +21 -0
  21. data/app/views/layouts/sooner/application.html.erb +14 -0
  22. data/app/views/sooner/admin/subscribers/_form.html.erb +19 -0
  23. data/app/views/sooner/admin/subscribers/edit.html.erb +6 -0
  24. data/app/views/sooner/admin/subscribers/index.html.erb +22 -0
  25. data/app/views/sooner/admin/subscribers/new.html.erb +8 -0
  26. data/app/views/sooner/admin/subscribers/show.html.erb +5 -0
  27. data/app/views/sooner/subscribers/_message.html.erb +1 -0
  28. data/app/views/sooner/subscribers/create.js.erb +5 -0
  29. data/app/views/sooner/subscribers/new.html.erb +17 -10
  30. data/app/views/sooner/subscribers_mailer/subscribed.text.erb +3 -0
  31. data/config/routes.rb +8 -3
  32. data/lib/generators/sooner/install/install_generator.rb +33 -32
  33. data/lib/generators/sooner/install/templates/README +3 -13
  34. data/lib/generators/sooner/views/views_generator.rb +49 -47
  35. data/lib/sooner/engine.rb +5 -0
  36. data/lib/sooner/version.rb +2 -2
  37. data/lib/sooner/version.rb~ +3 -0
  38. data/lib/sooner.rb +21 -12
  39. data/lib/tasks/sooner_tasks.rake +4 -0
  40. data/test/dummy/Rakefile +7 -0
  41. data/test/dummy/app/assets/javascripts/application.js +9 -0
  42. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  43. data/test/dummy/app/controllers/application_controller.rb +3 -0
  44. data/test/dummy/app/helpers/application_helper.rb +2 -0
  45. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  46. data/test/dummy/config/application.rb +45 -0
  47. data/test/dummy/config/boot.rb +10 -0
  48. data/test/dummy/config/database.yml +25 -0
  49. data/test/dummy/config/environment.rb +5 -0
  50. data/test/dummy/config/environments/development.rb +33 -0
  51. data/test/dummy/config/environments/production.rb +60 -0
  52. data/test/dummy/config/environments/test.rb +39 -0
  53. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  54. data/test/dummy/config/initializers/inflections.rb +10 -0
  55. data/test/dummy/config/initializers/mime_types.rb +5 -0
  56. data/test/dummy/config/initializers/secret_token.rb +7 -0
  57. data/test/dummy/config/initializers/session_store.rb +8 -0
  58. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  59. data/test/dummy/config/locales/en.yml +5 -0
  60. data/test/dummy/config/mongoid.yml +20 -0
  61. data/test/dummy/config/routes.rb +3 -0
  62. data/test/dummy/config.ru +4 -0
  63. data/test/dummy/db/development.sqlite3 +0 -0
  64. data/test/dummy/log/development.log +13370 -0
  65. data/test/dummy/public/404.html +26 -0
  66. data/test/dummy/public/422.html +26 -0
  67. data/test/dummy/public/500.html +26 -0
  68. data/test/dummy/public/favicon.ico +0 -0
  69. data/test/dummy/public/subscribers.csv +1 -0
  70. data/test/dummy/script/rails +6 -0
  71. data/test/dummy/tmp/cache/assets/C30/8B0/sprockets%2F6853748309a0fdd864824f56536d8023 +9062 -0
  72. data/test/dummy/tmp/cache/assets/C3F/0E0/sprockets%2F0e1cbc926773103d03774752e9108a00 +335 -0
  73. data/test/dummy/tmp/cache/assets/C66/FB0/sprockets%2F98a6552e0c72949d717178b5902e6f36 +71 -0
  74. data/test/dummy/tmp/cache/assets/C6D/F80/sprockets%2F44533615dbef3e810253094110825dac +62 -0
  75. data/test/dummy/tmp/cache/assets/C7A/910/sprockets%2F856f6b120c31d4622c49b3630219de68 +9069 -0
  76. data/test/dummy/tmp/cache/assets/C92/6A0/sprockets%2Fc5438348d868c777420d2e63fce56245 +98 -0
  77. data/test/dummy/tmp/cache/assets/C9C/A60/sprockets%2Fc6c3395667d18857f7f12369e53fa727 +350 -0
  78. data/test/dummy/tmp/cache/assets/CA7/430/sprockets%2F202cbe6f48604eb00549854f3053b58a +25 -0
  79. data/test/dummy/tmp/cache/assets/CB4/610/sprockets%2Ffeb1a7838d426857f0530993e420b60e +115 -0
  80. data/test/dummy/tmp/cache/assets/CE4/0D0/sprockets%2F439a9e8509403ac14ca356e5f2e9348b +7 -0
  81. data/test/dummy/tmp/cache/assets/CEB/DC0/sprockets%2F38536533e8e59a3fe0be483209c6d5c6 +352 -0
  82. data/test/dummy/tmp/cache/assets/CF6/900/sprockets%2F94575569edeb05737ebeaa60898940b6 +26 -0
  83. data/test/dummy/tmp/cache/assets/D07/4F0/sprockets%2Fe6091698b531dd271d5ac325b8b84ba0 +10 -0
  84. data/test/dummy/tmp/cache/assets/D19/BD0/sprockets%2F88636a6d051daca6365de6bd82096f48 +2445 -0
  85. data/test/dummy/tmp/cache/assets/D2B/3B0/sprockets%2F7de3b697dd206aa6eb292e301b140b60 +88 -0
  86. data/test/dummy/tmp/cache/assets/D39/410/sprockets%2Fa93af35d175ac7db006e63e91a0889b0 +42 -0
  87. data/test/dummy/tmp/cache/assets/D53/160/sprockets%2F8970dd07264d6eae78dd182d79df13c8 +303 -0
  88. data/test/dummy/tmp/cache/assets/D60/CE0/sprockets%2F06310f19d92bb4f40da80a37750ebdee +9 -0
  89. data/test/dummy/tmp/cache/assets/D65/620/sprockets%2F631e2801093d7a12aa6766bccaadfe88 +422 -0
  90. data/test/dummy/tmp/cache/assets/D7E/D20/sprockets%2Ff491cba4ec5176a691d9e5d7fc70892c +9052 -0
  91. data/test/dummy/tmp/cache/assets/D88/580/sprockets%2Ffef9b1c3b3b1b0316917a509cb1afb42 +439 -0
  92. data/test/dummy/tmp/cache/assets/D8E/B60/sprockets%2F1bc4810ecfe6a7b05c934eb3b0c2963a +9064 -0
  93. data/test/dummy/tmp/cache/assets/D99/D60/sprockets%2F29025313ddeaa1ff18cade1ed728949a +41 -0
  94. data/test/dummy/tmp/cache/assets/D9E/FD0/sprockets%2Ff8c955f36a2caa4039a66afc4c376e3a +0 -0
  95. data/test/dummy/tmp/cache/assets/DA5/1C0/sprockets%2Fec8cd61eddd7205e7c9c647f59413ac0 +371 -0
  96. data/test/dummy/tmp/cache/assets/DAF/6E0/sprockets%2F1b832fdf9fb97a8a7bcd2c907e652f47 +2386 -0
  97. data/test/dummy/tmp/cache/assets/DBC/650/sprockets%2Fd6da39f6f3f4a37c0db10cbc34ab0681 +67 -0
  98. data/test/dummy/tmp/cache/assets/DC2/150/sprockets%2F5cd685a35e3b593acade42a3b01def72 +8 -0
  99. data/test/dummy/tmp/cache/assets/DC7/530/sprockets%2Fea29d9af8aad9da0803062d3d7c06ac8 +373 -0
  100. data/test/dummy/tmp/cache/assets/DC9/2C0/sprockets%2Fbe1b3f07eb2f550c47c493a6f9a0de7b +333 -0
  101. data/test/dummy/tmp/cache/assets/DD6/820/sprockets%2Fb453f0fef899e0c6fe08aba14b94d09e +45 -0
  102. data/test/dummy/tmp/cache/assets/DD7/130/sprockets%2F6af271c6eec0698bc95224abf1ebf9f6 +390 -0
  103. data/test/dummy/tmp/cache/assets/E03/200/sprockets%2F8bd487cf65caa9fe453abd16be83e0a7 +70 -0
  104. data/test/dummy/tmp/cache/assets/E1D/680/sprockets%2Fc5c6b0ea20de8ef4d2f1eed00a35c93c +25 -0
  105. data/test/dummy/tmp/cache/assets/E49/440/sprockets%2Fbb92f156efb75bdda7bbacc04acb1425 +27 -0
  106. data/test/dummy/tmp/cache/assets/E59/430/sprockets%2Fb3073d96f7bcefcbdd3cdabe09a45a74 +286 -0
  107. data/test/dummy/tmp/cache/assets/E84/430/sprockets%2F61ffc0ed6338cebfdac2f1d3eaf0ae47 +9420 -0
  108. data/test/fixtures/sooner/admin/subscribers.yml +11 -0
  109. data/test/fixtures/sooner/subscribers.yml +7 -0
  110. data/test/functional/sooner/admin/subscribers_controller_test.rb +51 -0
  111. data/test/functional/sooner/subscribers_controller_test.rb +51 -0
  112. data/test/functional/sooner/subscribers_mailer_test.rb +14 -0
  113. data/test/integration/navigation_test.rb +10 -0
  114. data/test/sooner_test.rb +7 -0
  115. data/test/test_helper.rb +10 -0
  116. data/test/unit/helpers/sooner/admin/subscribers_helper_test.rb +6 -0
  117. data/test/unit/helpers/sooner/subscribers_helper_test.rb +6 -0
  118. data/test/unit/sooner/admin/subscriber_test.rb +9 -0
  119. data/test/unit/sooner/subscriber_test.rb +9 -0
  120. metadata +252 -53
  121. data/Gemfile +0 -4
  122. data/lib/sooner/email_format_validator.rb +0 -9
  123. data/lib/sooner/rails.rb +0 -5
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2010 Sooner
1
+ Copyright 2011 YOURNAME
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
File without changes
data/Rakefile CHANGED
@@ -1,43 +1,39 @@
1
- # encoding: UTF-8
2
-
3
- require 'rake'
4
- require 'rake/rdoctask'
5
- require 'rake/gempackagetask'
6
- require 'rake/testtask'
7
- require File.join(File.dirname(__FILE__), 'lib', 'sooner', 'version')
8
-
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.libs << 'test'
12
- t.pattern = 'test/**/*_test.rb'
13
- t.verbose = false
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
14
13
  end
15
14
 
16
- task :default => :test
17
-
18
- Rake::RDocTask.new(:rdoc) do |rdoc|
15
+ RDoc::Task.new(:rdoc) do |rdoc|
19
16
  rdoc.rdoc_dir = 'rdoc'
20
17
  rdoc.title = 'Sooner'
21
- rdoc.options << '--line-numbers' << '--inline-source'
18
+ rdoc.options << '--line-numbers'
22
19
  rdoc.rdoc_files.include('README.rdoc')
23
20
  rdoc.rdoc_files.include('lib/**/*.rb')
24
21
  end
25
22
 
26
- spec = Gem::Specification.new do |s|
27
- s.name = "sooner"
28
- s.summary = "PreLaunching Application for ComingSoon Pages"
29
- s.description = "Sooner Comingsoon Application"
30
- s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
31
- s.version = Sooner::VERSION.dup
32
- s.email = "sbertel@mobithought.com"
33
- s.homepage = "http://github.com/shenoudab/sooner"
34
- s.author = 'Shenouda Bertel'
35
- end
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
36
25
 
37
- Rake::GemPackageTask.new(spec) do |pkg|
26
+
27
+ Bundler::GemHelper.install_tasks
28
+
29
+ require 'rake/testtask'
30
+
31
+ Rake::TestTask.new(:test) do |t|
32
+ t.libs << 'lib'
33
+ t.libs << 'test'
34
+ t.pattern = 'test/**/*_test.rb'
35
+ t.verbose = false
38
36
  end
39
37
 
40
- desc "Install the gem #{spec.name}-#{spec.version}.gem"
41
- task :install do
42
- system("gem install pkg/#{spec.name}-#{spec.version}.gem --no-ri --no-rdoc")
43
- end
38
+
39
+ task :default => :test
@@ -0,0 +1,8 @@
1
+ //= require jquery
2
+ //= require ../jquery.tablesorter.min
3
+
4
+ $(document).ready(function() {
5
+ $("#subscribers_list").tablesorter({
6
+ sortList:[[1,0]]
7
+ })
8
+ });
@@ -0,0 +1,2 @@
1
+ //= require jquery
2
+ //= require jquery_ujs
@@ -0,0 +1,4 @@
1
+
2
+ (function($){$.extend({tablesorter:new
3
+ function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
4
+ var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -0,0 +1,37 @@
1
+ /*
2
+ *= require bootstrap
3
+ *= require_self
4
+ */
5
+ /* Override some defaults */
6
+ html, body {
7
+ background-color:#eee;
8
+ }
9
+ body {
10
+ padding-top:40px; /* 40px to make the container go all the way to the bottom of the topbar */
11
+ }
12
+ .container> footer p {
13
+ text-align:center; /* center align it with the container */
14
+ }
15
+ .container {
16
+ width:820px; /* downsize our container to make the content feel a bit tighter and more cohesive. NOTE: this removes two full columns from the grid, meaning you only go to 14 columns and not 16. */
17
+ }
18
+ .content {
19
+ background-color:white;
20
+ padding:20px;
21
+ margin:0 -20px;
22
+ -webkit-border-radius:6px 6px 6px 6px;
23
+ -moz-border-radius:6px 6px 6px 6px;
24
+ border-radius:6px 6px 6px 6px;
25
+ -webkit-box-shadow:0 1px 2px rgba(0,0,0,.15);
26
+ -moz-box-shadow:0 1px 2px rgba(0,0,0,.15);
27
+ box-shadow:0 1px 2px rgba(0,0,0,.15);
28
+ }
29
+ /* Page header tweaks */
30
+ .page-header {
31
+ -webkit-border-radius:6px 6px 0 0;
32
+ -moz-border-radius:6px 6px 0 0;
33
+ border-radius:6px 6px 0 0;
34
+ background-color:#f5f5f5;
35
+ padding:20px 20px 10px;
36
+ margin:-20px -20px 20px;
37
+ }
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_self
3
+ */
File without changes
@@ -0,0 +1,89 @@
1
+ module Sooner
2
+ class Admin::SubscribersController < ApplicationController
3
+ http_basic_authenticate_with :name => Sooner.admin_username, :password => Sooner.admin_password
4
+
5
+ layout "sooner/admin"
6
+
7
+ # GET /admin/subscribers
8
+ # GET /admin/subscribers.json
9
+ def index
10
+ @subscribers = Subscriber.all
11
+
12
+ respond_to do |format|
13
+ format.html # index.html.erb
14
+ format.json { render json: @subscribers }
15
+ end
16
+ end
17
+
18
+ # GET /admin/subscribers/1
19
+ # GET /admin/subscribers/1.json
20
+ def show
21
+ @subscriber = Subscriber.find(params[:id])
22
+
23
+ respond_to do |format|
24
+ format.html # show.html.erb
25
+ format.json { render json: @subscriber }
26
+ end
27
+ end
28
+
29
+ # GET /admin/subscribers/new
30
+ # GET /admin/subscribers/new.json
31
+ def new
32
+ @subscriber = Subscriber.new
33
+
34
+ respond_to do |format|
35
+ format.html # new.html.erb
36
+ format.json { render json: @subscriber }
37
+ end
38
+ end
39
+
40
+ # GET /admin/subscribers/1/edit
41
+ def edit
42
+ @subscriber = Subscriber.find(params[:id])
43
+ end
44
+
45
+ # POST /admin/subscribers
46
+ # POST /admin/subscribers.json
47
+ def create
48
+ @subscriber = Subscriber.new(params[:subscriber])
49
+
50
+ respond_to do |format|
51
+ if @subscriber.save
52
+ format.html { redirect_to @subscriber, notice: 'Subscriber was successfully created.' }
53
+ format.json { render json: @subscriber, status: :created, location: @subscriber }
54
+ else
55
+ format.html { render action: "new" }
56
+ format.json { render json: @subscriber.errors, status: :unprocessable_entity }
57
+ end
58
+ end
59
+ end
60
+
61
+ # PUT /admin/subscribers/1
62
+ # PUT /admin/subscribers/1.json
63
+ def update
64
+ @subscriber = Subscriber.find(params[:id])
65
+
66
+ respond_to do |format|
67
+ if @subscriber.update_attributes(params[:subscriber])
68
+ format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }
69
+ format.json { head :ok }
70
+ else
71
+ format.html { render action: "edit" }
72
+ format.json { render json: @subscriber.errors, status: :unprocessable_entity }
73
+ end
74
+ end
75
+ end
76
+
77
+ # DELETE /admin/subscribers/1
78
+ # DELETE /admin/subscribers/1.json
79
+ def destroy
80
+ @subscriber = Subscriber.find(params[:id])
81
+ @subscriber.destroy
82
+
83
+ respond_to do |format|
84
+ format.html { redirect_to subscribers_url }
85
+ format.json { head :ok }
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,4 @@
1
+ module Sooner
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -1,32 +1,36 @@
1
1
  module Sooner
2
2
  class SubscribersController < ApplicationController
3
-
4
- unloadable
5
-
3
+ respond_to :html, :js
4
+ # GET /subscribers/new
5
+ # GET /subscribers/new.json
6
6
  def new
7
7
  @subscriber = Subscriber.new
8
+
9
+ respond_to do |format|
10
+ format.html # new.html.erb
11
+ format.json { render json: @subscriber }
12
+ end
8
13
  end
9
14
 
15
+ # POST /subscribers
16
+ # POST /subscribers.json
10
17
  def create
11
- @subscriber = Subscriber.new(params[:sooner_subscriber])
18
+ @subscriber = Subscriber.new(params[:subscriber])
12
19
  if @subscriber.valid?
13
20
  if Sooner.csv_store
14
- @subscriber.save_csv
15
- end
16
- if Sooner.db_store
17
- @subscriber.save
18
- end
19
- render :update do |page|
20
- page.replace_html 'sooner_subscriber', Sooner.subscribed
21
+ @subscriber.save_csv
21
22
  end
22
- elsif @subscriber.errors[:name].include?('has already been taken') || @subscriber.errors[:email].include?('has already been taken')
23
- render :update do |page|
24
- page.replace_html 'sooner_subscriber', Sooner.already_subscribed
23
+ if Sooner.mongo_store
24
+ @subscriber.save
25
25
  end
26
+ SubscribersMailer.subscribed(@subscriber).deliver
27
+ respond_with @subscriber, :location => root_url
28
+ elsif @subscriber.errors[:email].include?("is already taken") || @subscriber.errors[:name].include?("is already taken")
29
+ respond_with @subscriber, :location => root_url
26
30
  else
27
31
  flash[:notice] = Sooner.error_subscribed
28
- redirect_to new_subscriber_path
32
+ redirect_to root_url
29
33
  end
30
34
  end
31
35
  end
32
- end
36
+ end
@@ -0,0 +1,4 @@
1
+ module Sooner
2
+ module Admin::SubscribersHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Sooner
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Sooner
2
+ module SubscribersHelper
3
+ end
4
+ end
@@ -0,0 +1,16 @@
1
+ module Sooner
2
+ class SubscribersMailer < ActionMailer::Base
3
+ default from: Sooner.sooner_mail
4
+
5
+ # Subject can be set in your I18n file at config/locales/en.yml
6
+ # with the following lookup:
7
+ #
8
+ # en.subscribers_mailer.subscribed.subject
9
+ #
10
+ def subscribed(user)
11
+ @greeting = "Hi"
12
+
13
+ mail to: user.email
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ class Admin::Subscriber
2
+ include Mongoid::Document
3
+ end
@@ -1,23 +1,30 @@
1
1
  module Sooner
2
- class Subscriber < ActiveRecord::Base
3
-
4
- validates :email, :presence => true, :uniqueness => true, :email_format => true
5
- validates :name, :presence => true, :uniqueness => true, :if => :should_validate
6
-
7
- # writes email addresses to CSV file
2
+ class Subscriber
3
+ include Mongoid::Document
4
+ field :name, :type => String, default: ""
5
+ field :email, :type => String
6
+
7
+ validates :email, :presence => true, :uniqueness => true
8
+ validates :name, :presence => true, :if => :name_required
9
+
10
+ validates_format_of :email, with: /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
11
+ def name_required
12
+ Sooner.name_required
13
+ end
14
+
8
15
  def save_csv
9
16
  begin
10
17
  file = File.open("public/#{ Sooner.csv_file.nil? ? 'subscribers.csv' : Sooner.csv_file }", "a")
11
- file << "#{ name },#{ email }\n"
18
+ if Sooner.name_required
19
+ file << "#{ name },#{ email }\n"
20
+ else
21
+ file << "#{ email }\n"
22
+ end
12
23
  file.close
13
24
  return true
14
25
  rescue Exception => e
15
26
  self.errors.add_to_base(e.message + " (CSV)")
16
27
  end
17
28
  end
18
-
19
- def should_validate
20
- Sooner.name_validations
21
- end
22
29
  end
23
- end
30
+ end
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Sooner</title>
5
+ <%= stylesheet_link_tag "sooner/admin/application" %>
6
+ <%= javascript_include_tag "sooner/admin/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <div class="content">
12
+ <%= yield %>
13
+ </div>
14
+ <footer>
15
+ <p>
16
+ © mobiThought 2011
17
+ </p>
18
+ </footer>
19
+ </div>
20
+ </body>
21
+ </html>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
6
+ <title>Sooner</title>
7
+ <%= stylesheet_link_tag "sooner/application" %>
8
+ <%= javascript_include_tag "sooner/application" %>
9
+ <%= csrf_meta_tags %>
10
+ </head>
11
+ <body lang="en">
12
+ <%= yield %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,19 @@
1
+ <%= form_for(@subscriber) do |f| %>
2
+ <% if @subscriber.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@subscriber.errors.count, "error") %> prohibited this subscriber from being saved:</h2>
5
+ <ul>
6
+ <% @subscriber.errors.full_messages.each do |msg| %>
7
+ <li>
8
+ <%= msg %>
9
+ </li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+
15
+ <%= f.text_field :name, :placeholder => "Enter subscriber Name" %>
16
+ <%= f.text_field :email, :placeholder => "Enter subscriber Email" %>
17
+ <%= f.submit "Add Subscriber" %>
18
+
19
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing subscriber</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @subscriber %> |
6
+ <%= link_to 'Back', admin_subscribers_path %>
@@ -0,0 +1,22 @@
1
+ <div class="page-header">
2
+ <h1>Subscribers List <small> Your App upcoming users</small></h1>
3
+ </div>
4
+ <table class="zebra-striped" id="subscribers_list">
5
+ <tr>
6
+ <th>#</th>
7
+ <th>Name</th>
8
+ <th>Email</th>
9
+ </tr>
10
+ <% @subscribers.each_with_index do |subscriber, index| %>
11
+ <tr>
12
+ <td><%= index + 1 %></td>
13
+ <td><%= subscriber.name %></td>
14
+ <td><%= subscriber.email %></td>
15
+ <!-- <td><%= link_to 'Show', subscriber %> |
16
+ <%= link_to 'Edit', edit_admin_subscriber_path(subscriber) %> |
17
+ <%= link_to 'Destroy', subscriber, confirm: 'Are you sure?', method: :delete %></td> -->
18
+ </tr>
19
+ <% end %>
20
+ </table>
21
+ <br />
22
+ <%= link_to 'New Subscriber', new_admin_subscriber_path %>
@@ -0,0 +1,8 @@
1
+ <div class="page-header">
2
+ <h1>Add new Subscriber</h1>
3
+ </div>
4
+ <div id="subscriber">
5
+ <%= render 'form' %>
6
+ </div>
7
+
8
+ <%= link_to 'Back', admin_subscribers_path %>
@@ -0,0 +1,5 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+
4
+ <%= link_to 'Edit', edit_admin_subscriber_path(@subscriber) %> |
5
+ <%= link_to 'Back', admin_subscribers_path %>
@@ -0,0 +1 @@
1
+ Thanks <%= @subscriber.name %>, for being interest in Our Application
@@ -0,0 +1,5 @@
1
+ <% if @subscriber.errors[:name].include?("is already taken") || @subscriber.errors[:email].include?("is already taken")%>
2
+ $('#subscriber').html("<%= Sooner.already_subscribed %>");
3
+ <% else %>
4
+ $('#subscriber').html("<%= escape_javascript(render('message')) %>");
5
+ <% end %>
@@ -1,11 +1,18 @@
1
- <div id="sooner_subscriber">
2
- <%= form_for @subscriber, :url => subscribers_path, :remote => true do |f| %>
3
- <%= f.label :name %>
4
- <%= f.text_field :name %>
5
- <br />
6
- <%= f.label :email %>
7
- <%= f.text_field :email %>
8
-
9
- <%= f.submit "Subscribe" %>
10
- <% end %>
1
+ <div id="subscriber">
2
+ <%= form_for @subscriber, :remote => true do |f| %>
3
+ <% if @subscriber.errors.any? %>
4
+ <div id="error_explanation">
5
+ <h2><%= pluralize(@subscriber.errors.count, "error") %> prohibited this subscriber from being saved:</h2>
6
+ <ul>
7
+ <% @subscriber.errors.full_messages.each do |msg| %>
8
+ <li>
9
+ <%= msg %>
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
14
+ <% end %>
15
+ <%= f.text_field :email, :placeholder => "Enter your e-mail" %>
16
+ <%= f.submit "Subscribe" %>
17
+ <% end %>
11
18
  </div>
@@ -0,0 +1,3 @@
1
+ SubscribersMailer#subscribed
2
+
3
+ <%= @greeting %>, find me in app/views/app/views/sooner/subscribers_mailer/subscribed.text.erb
data/config/routes.rb CHANGED
@@ -1,3 +1,8 @@
1
- Rails.application.routes.draw do |map|
2
- resources :subscribers, :controller => 'sooner/subscribers', :only => [:new, :create]
3
- end
1
+ Sooner::Engine.routes.draw do
2
+ resources :subscribers
3
+ namespace :admin do
4
+ resources :subscribers
5
+ root :to => 'subscribers#index'
6
+ end
7
+ root :to => 'subscribers#new'
8
+ end