You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/09/13 16:01:14 UTC
[whimsy] branch master updated: covert from React.js to Vue.js
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new c36f199 covert from React.js to Vue.js
c36f199 is described below
commit c36f1995f396d255c584424bd2b9705aefc4e58a
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Sep 13 12:00:27 2017 -0400
covert from React.js to Vue.js
Some minor modernizations done along the way (bootstrap, LDAP, id requirements)
---
www/test/icla/Gemfile | 2 +-
www/test/icla/main.rb | 2 +-
www/test/icla/package.json | 15 ---------------
www/test/icla/views/actions/validate.json.rb | 2 +-
www/test/icla/views/app.html.rb | 6 +-----
www/test/icla/views/app.js.rb | 2 ++
www/test/icla/views/main.js.rb | 11 +++++------
www/test/icla/views/markdown.js.rb | 15 +++++----------
www/test/icla/views/pages/complete.js.rb | 2 +-
www/test/icla/views/pages/form.js.rb | 11 ++++++-----
www/test/icla/views/pages/interview.js.rb | 2 +-
www/test/icla/views/pages/invite.js.rb | 8 ++++----
www/test/icla/views/pages/preview.js.rb | 2 +-
13 files changed, 29 insertions(+), 51 deletions(-)
diff --git a/www/test/icla/Gemfile b/www/test/icla/Gemfile
index 19282ed..85af820 100644
--- a/www/test/icla/Gemfile
+++ b/www/test/icla/Gemfile
@@ -13,7 +13,7 @@ end
gem 'rake'
gem 'wunderbar'
-gem 'ruby2js', '>= 2.0.0'
+gem 'ruby2js'
gem 'sinatra'
gem 'nokogumbo'
gem 'execjs', ('<2.5.1' if RUBY_VERSION =~ /^1/)
diff --git a/www/test/icla/main.rb b/www/test/icla/main.rb
index 924c378..f3a3060 100755
--- a/www/test/icla/main.rb
+++ b/www/test/icla/main.rb
@@ -5,7 +5,7 @@
require 'whimsy/asf'
require 'wunderbar/sinatra'
-require 'wunderbar/react'
+require 'wunderbar/vue'
require 'wunderbar/bootstrap/theme'
require 'ruby2js/filter/functions'
require 'ruby2js/filter/require'
diff --git a/www/test/icla/package.json b/www/test/icla/package.json
deleted file mode 100644
index 47a81d4..0000000
--- a/www/test/icla/package.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "package": "whimsy-icla",
- "version": "0.1.0",
-
- "repository": {
- "type": "svn",
- "url": "https://svn.apache.org/repos/infra/infrastructure/trunk/projects/whimsy/www/test/icla"
- },
-
- "devDependencies": {
- "jsdom": "^4.0.1",
- "jquery": "^2.1.3",
- "react": "^0.13.1"
- }
-}
diff --git a/www/test/icla/views/actions/validate.json.rb b/www/test/icla/views/actions/validate.json.rb
index fef5d9d..92aa1b0 100644
--- a/www/test/icla/views/actions/validate.json.rb
+++ b/www/test/icla/views/actions/validate.json.rb
@@ -41,7 +41,7 @@ if @votelink and not @votelink.empty?
end
# verify that the user submitting the form is on the PMC in question
- unless pmc and pmc.members.include? user
+ unless pmc and pmc.owners.include? user
_error "You must be on the #@pmc PMC to submit a vote link"
_focus :pmc
end
diff --git a/www/test/icla/views/app.html.rb b/www/test/icla/views/app.html.rb
index c693bfe..da6cba3 100755
--- a/www/test/icla/views/app.html.rb
+++ b/www/test/icla/views/app.html.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# encoding: utf-8
-require 'wunderbar'
+require 'wunderbar/bootstrap'
_html lang: 'en', _width: '80' do
_head_ do
@@ -8,10 +8,6 @@ _html lang: 'en', _width: '80' do
_link rel: 'shortcut icon',
href: '/favicon.ico'
_title 'ASF ICLA demo'
- _link href: 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700%7cDroid+Serif:400,700',
- rel: 'stylesheet', type: 'text/css'
- _link href: 'https://www.apache.org/css/min.bootstrap.css',
- rel: 'stylesheet'
_link href: 'https://www.apache.org/css/styles.css', rel: 'stylesheet'
_link href: 'css/icla.css', rel: 'stylesheet'
diff --git a/www/test/icla/views/app.js.rb b/www/test/icla/views/app.js.rb
index 1fa732d..ebccb65 100644
--- a/www/test/icla/views/app.js.rb
+++ b/www/test/icla/views/app.js.rb
@@ -1,3 +1,5 @@
+require_relative 'vue-config'
+
require_relative 'main'
require_relative 'pages'
diff --git a/www/test/icla/views/main.js.rb b/www/test/icla/views/main.js.rb
index 44f25df..16ef5a0 100644
--- a/www/test/icla/views/main.js.rb
+++ b/www/test/icla/views/main.js.rb
@@ -2,7 +2,7 @@
# Main class, nearly all scaffolding for demo purposes
#
-class Main < React
+class Main < Vue
def initialize
@view = Invite
end
@@ -11,18 +11,17 @@ class Main < React
_main do
_h1 'Demo: Invitation to Submit ICLA'
- React.createElement(@view)
+ Vue.createElement(@view)
end
end
# save data on first load
- def componentWillMount()
+ def created()
Server.data = @@data
- self.componentWillReceiveProps()
end
# set view based on properties
- def componentWillReceiveProps()
+ def mounted()
if @@view == 'interview'
@view = Interview
else
@@ -37,7 +36,7 @@ class Main < React
end
# export navigation method on the client
- def componentDidMount()
+ def mounted()
Main.navigate = self.navigate
end
end
diff --git a/www/test/icla/views/markdown.js.rb b/www/test/icla/views/markdown.js.rb
index 859e791..1b26aaa 100644
--- a/www/test/icla/views/markdown.js.rb
+++ b/www/test/icla/views/markdown.js.rb
@@ -2,13 +2,12 @@
# Convert markdown to html
#
-class Markdown < React
- def componentWillMount()
- self.componentWillReceiveProps()
+class Markdown < Vue
+ def render
+ _span domPropsInnerHTML: html
end
- def componentWillReceiveProps()
-
+ def html
# trim leading and trailing spaces
text = @@text.sub(/^\s*\n/, '').sub(/\s+$/, '')
@@ -28,10 +27,6 @@ class Markdown < React
end
# convert markdown to text
- @html = markd(text)
- end
-
- def render
- _span dangerouslySetInnerHTML: { __html: @html }
+ markd(text)
end
end
diff --git a/www/test/icla/views/pages/complete.js.rb b/www/test/icla/views/pages/complete.js.rb
index ba5c3f5..630d27c 100644
--- a/www/test/icla/views/pages/complete.js.rb
+++ b/www/test/icla/views/pages/complete.js.rb
@@ -1,4 +1,4 @@
-class Complete < React
+class Complete < Vue
def render
_p %{
At this point, the demo is complete. If this were a real application:
diff --git a/www/test/icla/views/pages/form.js.rb b/www/test/icla/views/pages/form.js.rb
index 070622a..95d1f88 100644
--- a/www/test/icla/views/pages/form.js.rb
+++ b/www/test/icla/views/pages/form.js.rb
@@ -1,4 +1,4 @@
-class Form < React
+class Form < Vue
def initialize
@disabled = true
@alert = nil
@@ -57,8 +57,9 @@ class Form < React
if FormData.votelink
_div.form_group do
- _p 'Preferred Apache Id (format: ^[a-z][-a-z0-9_]+$):'
- _input.form_control value: @apacheId, pattern: "^[a-z][-a-z0-9_]+$"
+ _p 'Preferred Apache Id (format: ^[a-z][-a-z0-9]{2,}$):'
+ _input.form_control.apacheId! value: @apacheId,
+ pattern: "^[a-z][-a-z0-9]{2,}$"
end
end
@@ -73,12 +74,12 @@ class Form < React
end
# initialize public name from invitation
- def componentWillMount()
+ def created()
@publicName = FormData.fullname
end
# when the form is initially loaded, set the focus on the address field
- def componentDidMount()
+ def mounted()
document.getElementById('fullname').focus()
end
diff --git a/www/test/icla/views/pages/interview.js.rb b/www/test/icla/views/pages/interview.js.rb
index 0e27e55..dd455f1 100644
--- a/www/test/icla/views/pages/interview.js.rb
+++ b/www/test/icla/views/pages/interview.js.rb
@@ -1,4 +1,4 @@
-class Interview < React
+class Interview < Vue
def initialize
@showQuestion1 = true
@showQuestion2 = false
diff --git a/www/test/icla/views/pages/invite.js.rb b/www/test/icla/views/pages/invite.js.rb
index fc6294e..9ecef11 100644
--- a/www/test/icla/views/pages/invite.js.rb
+++ b/www/test/icla/views/pages/invite.js.rb
@@ -1,4 +1,4 @@
-class Invite < React
+class Invite < Vue
def initialize
@disabled = true
@alert = nil
@@ -31,9 +31,9 @@ class Invite < React
#
_div.form_group do
- _label "Contributor's Name:", for: 'iclaname'
+ _label "Contributor's name:", for: 'iclaname'
_input.form_control.iclaname! placeholder: 'Firstname Lastname',
- required: true, onChange: self.setIclaName, value: @iclaname
+ required: true, value: @iclaname
end
_div.form_group do
@@ -122,7 +122,7 @@ class Invite < React
end
# when the form is initially loaded, set the focus on the iclaname field
- def componentDidMount()
+ def mounted()
document.getElementById('iclaname').focus()
end
diff --git a/www/test/icla/views/pages/preview.js.rb b/www/test/icla/views/pages/preview.js.rb
index 162773f..7f34f75 100644
--- a/www/test/icla/views/pages/preview.js.rb
+++ b/www/test/icla/views/pages/preview.js.rb
@@ -1,4 +1,4 @@
-class Preview < React
+class Preview < Vue
def initialize
@disabled = false
end
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].