VRFS-2697 website validator initial commit
This commit is contained in:
parent
7352fa9b19
commit
16092ba816
|
|
@ -0,0 +1,16 @@
|
|||
$ = jQuery
|
||||
context = window
|
||||
context.JK ||= {};
|
||||
|
||||
context.JK.WebsiteValidator = class WebsiteValidator
|
||||
constructor: (@app, input_id) ->
|
||||
@EVENTS = context.JK.EVENTS
|
||||
@rest = context.JK.Rest()
|
||||
@url_input = $(input_id)
|
||||
|
||||
init: () =>
|
||||
# @root = $($('#template-download-jamtrack').html())
|
||||
|
||||
validate: () =>
|
||||
regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
|
||||
regexp.test(@url_input.value)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
@import "client/common";
|
||||
|
||||
|
|
@ -37,4 +37,9 @@ class SpikesController < ApplicationController
|
|||
Notification.send_subscription_message('test', '2', '{"msg": "oh hai 2"}')
|
||||
render text: 'oh hai'
|
||||
end
|
||||
|
||||
def site_validate
|
||||
render :layout => 'web'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
input type='text' id="website_#{siteid}"
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
= javascript_include_tag "website_validator"
|
||||
= render "clients/website_validator", siteid: 'foobar'
|
||||
= stylesheet_link_tag "client/website_validator"
|
||||
|
||||
javascript:
|
||||
var initialized = false;
|
||||
$(document).on('JAMKAZAM_READY', function(e, data) {
|
||||
setTimeout(function() {
|
||||
window.website_validator = new JK.WebsiteValidator(data.app, "website_foobar")
|
||||
website_validator.init()
|
||||
$('#website_foobar').val('http://www.jamkazam.com')
|
||||
}, 1)
|
||||
})
|
||||
|
|
@ -92,6 +92,7 @@ SampleApp::Application.routes.draw do
|
|||
match '/launch_app', to: 'spikes#launch_app'
|
||||
match '/websocket', to: 'spikes#websocket'
|
||||
match '/test_subscription', to: 'spikes#subscription'
|
||||
match '/site_validate', to: 'spikes#site_validate'
|
||||
|
||||
# junk pages
|
||||
match '/help', to: 'static_pages#help'
|
||||
|
|
|
|||
Loading…
Reference in New Issue