[website] [minor] moving to framework

This commit is contained in:
Rushabh Mehta
2013-09-09 12:32:35 +05:30
parent c59c4e0699
commit e865de01ee
28 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
{% extends "app/website/templates/html/page.html" %}
{% set title="About Us" %}
{% block content %}
<div class="col-md-12">
{{ obj.doc.company_introduction or "<h2>About Us</h2><p>Some Introduction about your company that you would like your website visitor to know. More people than you think will read your About page. People always like to know who the are doing business with. Be authentic and avoid using jargon like 'value added services' etc. Be sure to update your company history and list of key team members in Website > About Us Settings</p>" }}
{% if obj.doclist.get({"doctype":"Company History"}) %}
<h3>{{ obj.doc.company_history_heading or "Company History" }}</h3>
{% for d in obj.doclist.get({"doctype":"Company History"}) %}
<div class="row">
<span class="col-md-2"><h4 style="margin:0px;">{{ d.year }}</h4></span>
<span class="col-md-10"><p>{{ d.highlight }}</p></span>
</div>
{% endfor %}
{% endif %}
{% if obj.doclist.get({"doctype":"About Us Team Member"}) %}
<h3>{{ obj.doc.team_members_heading or "Team Members" }}</h3>
{% for d in obj.doclist.get({"doctype":"About Us Team Member"}) %}
<div class="row" itemscope itemtype="http://schema.org/Person">
<span class="col-md-2">
<div class="avatar avatar-large">
<img class="avatar" src="{{ d.image_link }}" style="" itemprop="image">
</div>
</span>
<span class="col-md-10"><h4 itemprop="name">{{ d.full_name }}</h4>
<p itemprop="description">{{ d.bio }}</p>
</span>
</div>
{% endfor %}
{% endif %}
{{ obj.doc.footer or "" }}
</div>
{% endblock %}

View File

@@ -0,0 +1,7 @@
<style>
h2 > a, h2 > a:link, h2 > a:visited, h2 > a:active,
h2 > a:hover, h2 > a:focus {
text-decoration: none;
color: inherit;
}
</style>

View File

@@ -0,0 +1,86 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt
// js inside blog page
$(document).ready(function() {
// make list of blogs
blog.get_list();
$("#next-page").click(function() {
blog.get_list();
})
if(get_url_arg("by_name")) {
$("#blot-subtitle").html("Posts by " + get_url_arg("by_name")).toggle(true);
}
if(get_url_arg("category")) {
$("#blot-subtitle").html("Posts filed under " + get_url_arg("category")).toggle(true);
}
});
var blog = {
start: 0,
get_list: function() {
$.ajax({
method: "GET",
url: "server.py",
data: {
cmd: "website.doctype.blog_post.blog_post.get_blog_list",
start: blog.start,
by: get_url_arg("by"),
category: get_url_arg("category")
},
dataType: "json",
success: function(data) {
$(".progress").toggle(false);
if(data.exc) console.log(data.exc);
blog.render(data.message);
}
});
},
render: function(data) {
var $wrap = $("#blog-list");
$.each(data, function(i, b) {
// comments
if(!b.comments) {
b.comment_text = 'No comments yet.'
} else if (b.comments===1) {
b.comment_text = '1 comment.'
} else {
b.comment_text = b.comments + ' comments.'
}
b.page_name = encodeURIComponent(b.page_name);
$(repl('<div class="row">\
<div class="col-md-1">\
<div class="avatar avatar-medium" style="margin-top: 6px;">\
<img src="%(avatar)s" />\
</div>\
</div>\
<div class="col-md-11">\
<h4><a href="%(page_name)s">%(title)s</a></h4>\
<p>%(content)s</p>\
<p style="color: #aaa; font-size: 90%">\
<a href="blog?by=%(blogger)s&by_name=%(full_name)s">\
%(full_name)s</a> wrote this on %(published)s / %(comment_text)s</p>\
</div>\
</div><hr>', b)).appendTo($wrap);
});
blog.start += (data.length || 0);
if(!data.length || data.length < 20) {
if(blog.start) {
$("#next-page").toggle(false)
.parent().append("<div class='text-muted'>Nothing more to show.</div>");
} else {
$("#next-page").toggle(false)
.parent().append("<div class='alert alert-warning'>No blogs written yet.</div>");
}
} else {
$("#next-page").toggle(true);
}
}
}

View File

@@ -0,0 +1,13 @@
<style>
.comment-title {
color:#777;
}
.comment-content {
margin-left: 20px;
}
input {
width: 240px;
}
</style>

View File

@@ -0,0 +1,65 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt
// js inside blog page
$(document).ready(function() {
var n_comments = $(".comment-row").length;
if(n_comments) {
$(".no_comment").toggle(false);
}
if(n_comments > 50) {
$(".add-comment").toggle(false)
.parent().append("<div class='alert alert-warning'>Comments are closed.</div>")
}
$(".add-comment").click(function() {
$(this).toggle(false);
$("#comment-form").toggle();
$("#comment-form input, #comment-form, textarea").val("");
})
$("#submit-comment").click(function() {
var args = {
comment_by_fullname: $("[name='comment_by_fullname']").val(),
comment_by: $("[name='comment_by']").val(),
comment: $("[name='comment']").val(),
cmd: "website.doctype.blog_post.blog_post.add_comment",
comment_doctype: "Blog Post",
comment_docname: "{{ name }}",
page_name: "{{ page_name }}",
_type: "POST"
}
$("#comment-form .alert").toggle(false);
if(!args.comment_by_fullname || !args.comment_by || !args.comment) {
$("#comment-form .alert")
.html("All fields are necessary to submit the comment.")
.toggle(true);
return false;
}
$.ajax({
type: "POST",
url: "server.py",
data: args,
dataType: "json",
success: function(data) {
if(data.exc) {
$("#comment-form .alert")
.html(data.exc)
.toggle(true)
} else {
$(data.message).appendTo(".blog-comments");
$(".no_comment").toggle(false);
$(".add-comment").toggle(false);
$("#comment-form")
.replaceWith("<div class='alert alert-success'>Thank you for your comment!</div>")
}
}
})
return false;
})
})

View File

@@ -0,0 +1,60 @@
{% extends "app/website/templates/html/page.html" %}
{% block javascript %}
{% include "app/website/templates/js/contact.js" %}
{% endblock %}
{% set title="Contact Us" %}
{% block content %}
<div class="col-md-12">
<h3>{{ obj.doc.heading or "Contact Us"}}</h3>
<div class="row">
<div class="web-form col-md-8">
<p id="contact-alert" class="alert alert-warning"
style="display: none;">&nbsp;</p>
<p>
<select name="subject" class="form-control">
{% for option in obj.query_options %}
<option value="{{ option }}">{{ option }}</option>
{% endfor %}
</select>
</p>
<p>
<input class="form-control" name="email" type="text"
placeholder="Your Email Address" />
</p>
<p>
<textarea rows="10" name="message" class="form-control"></textarea>
</p>
<p>
<button class="btn btn-primary btn-send">Send</button>
</p>
</div>
{% if obj.doc.address %}
<div class="col-md-3 col-md-offset-1 alert alert-warning" style="margin-top: 20px;" itemscope itemtype="http://schema.org/PostalAddress">
<h4><i class="icon-map-marker"></i> {{ obj.address.address_title }}</h4>
{% if obj.address.address_line1 %}
<span itemprop="streetAddress">{{ obj.address.address_line1 }}</span><br>
{% endif %}
{% if obj.address.address_line2 %}
<span itemprop="streetAddress">{{ obj.address.address_line2 }}</span><br>
{% endif %}
{% if obj.address.city %}
<span itemprop="addressLocality">{{ obj.address.city }}</span><br>
{% endif %}
{% if obj.address.state %}
<span itemprop="addressRegion">{{ obj.address.state }}</span><br>
{% endif %}
{% if obj.address.pincode %}
<span itemprop="postalCode">{{ obj.address.pincode }}</span><br>
{% endif %}
{% if obj.address.country %}
<span itemprop="addressCountry">{{ obj.address.country }}</span><br>
{% endif %}
</div>
{% endif %}
</div>
{{ obj.doc.introduction }}
</div>
{% endblock %}

View File

@@ -0,0 +1,45 @@
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
// License: GNU General Public License v3. See license.txt
$(document).ready(function() {
$('.btn-send').click(function() {
var email = $('[name="email"]').val();
var message = $('[name="message"]').val();
if(!(email && message)) {
msgprint("Please enter both your email and message so that we \
can get back to you. Thanks!");
return false;
}
if(!valid_email(email)) {
msgprint("You seem to have written your name instead of your email. \
Please enter a valid email address so that we can get back.");
$('[name="email"]').focus();
return false;
}
$("#contact-alert").toggle(false);
erpnext.send_message({
subject: $('[name="subject"]').val(),
sender: email,
message: message,
callback: function(r) {
if(r.status==="okay") {
msgprint(r.message || "Thank you for your message.")
} else {
msgprint("There were errors");
console.log(r.exc);
}
$(':input').val('');
}
});
return false;
});
});
var msgprint = function(txt) {
if(txt) $("#contact-alert").html(txt).toggle(true);
}

View File

@@ -0,0 +1 @@
{% extends "app/website/templates/html/web_page.html" %}

View File

@@ -0,0 +1,14 @@
{% extends "app/website/templates/html/page.html" %}
{% block javascript %}
{% if insert_code %}
{{ javascript }}
{% endif %}
{% endblock %}
{% block content %}
<div class="col-md-12" style="margin-top: 15px;">
{% include "app/website/templates/html/slideshow.html" %}
{{ main_section }}
</div>
{% endblock %}

View File

@@ -0,0 +1,39 @@
{% if slideshow %}
{{ slideshow_header }}
<div id="the-carousel" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
{% for slide in obj.slides %}
<li data-target="#the-carousel" data-slide-to="0"
{%- if loop.index==0 %}class="active"{% endif %}></li>
{% endfor %}
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
{% for slide in obj.slides %}
<div class="{% if slide.idx==1 %}active {% endif %}item">
<img src="{{ slide.image }}" />
{% if slide.heading or slide.description %}
<div class="carousel-caption">
{% if slide.heading %}<h4>{{ slide.heading }}</h4>{% endif %}
{% if slide.description %}<p>{{ slide.description }}</p>{% endif %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
<!-- Controls -->
<a class="left carousel-control" href="#the-carousel" data-slide="prev">
<span class="icon icon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#the-carousel" data-slide="next">
<span class="icon icon-chevron-right"></span>
</a>
</div>
<script>$(".carousel").carousel();</script>
{% endif %}