Skip to content

Instantly share code, notes, and snippets.

@r01010010
Last active August 29, 2015 14:12
Show Gist options
  • Save r01010010/3848855d80e7ce7ca405 to your computer and use it in GitHub Desktop.
Save r01010010/3848855d80e7ce7ca405 to your computer and use it in GitHub Desktop.
angular.js
html
head
meta(name="viewport" content="width=device-width, initial-scale=1")
//
HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
//if lt IE 9
script(src='https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js')
script(src='https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js')
link(href='/public/css/bootstrap.css', rel='stylesheet')
link(href='/public/css/app.css', rel='stylesheet')
script(src='/public/js/angular.js')
script(src='/public/js/locales/angular-locale_es-es.js')
script(src='/public/js/jquery-1.11.1.js')
script(src='/public/js/bootstrap.js')
script(language="javascript").
angular.module('appNewPost', [])
.controller('PostController', ['$scope', '$http', function($scope, $http) {
$scope.post = !{post};
$scope.submit = function(){
$http({
method : 'POST',
url : 'http://localhost:3000/rest/post/post',
data : $scope.post
}).success(function(res){
console.log($scope.postForm);
console.log(res.result);
})
}
}]);
body
div.col-sm-4
br
div(id="logo")
img(src="/public/img/wizcopsd.jpg")
br
div
p
!{__('p.wellcome_to_wizco')}
div#form(ng-app="appNewPost", ng-controller="PostController")
p
form(name="postForm", role="form", class="css-form", novalidate)
div.alert.alert-danger(ng-show="form.$submitted") #{__('forms.err_title')}
div(class="form-group")
label(for="name", class="control-label") #{__("forms.label_u_name")}
input(type="text", ng-model="post.user.name", id="name", name="name", class="form-control", placeholder="#{__('forms.eg_u_name')}", required)
p.error-block(ng-show="postForm.err") Pon algo tú!
div(class="form-group")
label.control-label(for="name") #{__("forms.label_u_gender")}
br
label.checkbox-inline
input#checkboxEnLinea3(type="checkbox", value="")
| #{__("forms.opt_u_woman")}
label.checkbox-inline
input#checkboxEnLinea3(type="checkbox", value="")
| #{__("forms.opt_u_man")}
label.checkbox-inline
input#checkboxEnLinea3(type="checkbox", value="")
| #{__("forms.opt_u_other")}
div.form-group
label.control-label #{__('forms.label_u_province')}
select.form-control(ng-model="post.user.province")
option(value="")
| #{__('forms.opt_province_cero')}
each province, i in provinces
option(value="#{province.slug}")
= province.name
div.form-group
label.control-label(for="title") #{__('forms.label_p_title')}
input.form-control(type="text", ng-model="post.title" id="title", name="title", placeholder="#{__('forms.eg_p_title')}")
div.form-group
label.control-label(for="description") #{__('forms.label_p_description')}
textarea.form-control(ng-model="post.description" id="description", name="description", placeholder="#{__('forms.eg_p_description')}", cols="15", rows="4")
div.form-group
label.control-label(for="email") #{__('forms.label_u_email')}
input.form-control(ng-model="post.user.email" type="email", id="email", name="email", placeholder="#{__('forms.eg_u_email')}")
//
span(class="help-block small", style="color:#F8F8DF ") ¿Quién es Rick Deckard?
a(href="#") Ver
p
div.form-group
input.btn.btn-danger(type="submit", ng-click="submit()" value="#{__('bt.publish')}")
input(type="button", value="#{__('bt.cancel')}", class="btn btn-link")
div#formresponse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment