Skip to content

Commit

Permalink
Themes templates implemented
Browse files Browse the repository at this point in the history
Themes templates implemented
  • Loading branch information
vidyasagar-r authored and ashwin31 committed Jul 19, 2016
1 parent 8bb2678 commit 76b6223
Show file tree
Hide file tree
Showing 27 changed files with 1,073 additions and 188 deletions.
1 change: 1 addition & 0 deletions django_blog_it/django_blog_it/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def save(self, commit=True):
user.save()
return user


class AdminLoginForm(forms.Form):
username = forms.CharField(max_length=254)
password = forms.CharField(label="Password", widget=forms.PasswordInput)
Expand Down

This file was deleted.

25 changes: 25 additions & 0 deletions django_blog_it/django_blog_it/migrations/0010_theme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-18 10:14
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('django_blog_it', '0009_contactussettings'),
]

operations = [
migrations.CreateModel(
name='Theme',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20, unique=True)),
('slug', models.CharField(max_length=20, unique=True)),
('description', models.CharField(max_length=500)),
('enabled', models.BooleanField(default=False)),
],
),
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-07-19 10:28
# Generated by Django 1.9.7 on 2016-07-19 11:40
from __future__ import unicode_literals

from django.db import migrations, models
Expand All @@ -8,20 +8,10 @@
class Migration(migrations.Migration):

dependencies = [
('django_blog_it', '0010_auto_20160715_0653'),
('django_blog_it', '0010_theme'),
]

operations = [
migrations.CreateModel(
name='Theme',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20, unique=True)),
('slug', models.CharField(max_length=20, unique=True)),
('description', models.CharField(max_length=500)),
('enabled', models.BooleanField(default=False)),
],
),
migrations.AddField(
model_name='category',
name='meta_description',
Expand Down
44 changes: 22 additions & 22 deletions django_blog_it/django_blog_it/static/css/frontend_main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
{% if request.user.is_superuser or request.user|get_user_role_name != 'Author' %}
{% ifequal blog.status "Trashed" %}
<a href='#' class="restore manage_blog" action="restore" title="Restore from trash"><i class="fa fa-refresh"></i> Restore</a>
<a href='#' class="delete manage_blog" action="delete" title="Permanently delete from trash"><i class="fa fa-trash-o"></i> Delete</a>
<a href='#' class="delete manage_blog" action="delete" title="Permanently delete from trash" data-confirm="true"><i class="fa fa-trash-o"></i> Delete</a>
{% else %}
<a href='#' class="trash manage_blog" action="trash" title="Move to Trash"><i class="fa fa-times"></i> Trash</a>
{% endifequal %}
Expand All @@ -131,13 +131,24 @@ <h2 align="center"> There are no blog-posts here !</h2>
</div>

{% endblock %}
{% block delete_confirmation %}
{% endblock delete_confirmation %}
{% block js_script %}
<script type="text/javascript">

$('.dashboard').addClass('active');
$('.manage_blog').click(function(e){
e.preventDefault();
$(this).siblings("form.blog_trash_form").children("input[name='action']").val($(this).attr('action'));
if ($(this).attr('action') == 'delete'){
var confirmation = confirm("Are you sure?");
if (confirmation){
$(this).siblings("form.blog_trash_form").children("input[name='action']").val($(this).attr('action'));
}else {
return
}
}else{
$(this).siblings("form.blog_trash_form").children("input[name='action']").val($(this).attr('action'));
}
$(this).siblings("form.blog_trash_form").submit();
});

Expand Down Expand Up @@ -189,6 +200,7 @@ <h2 align="center"> There are no blog-posts here !</h2>

$('.pagination li a').click(function(event){
event.preventDefault();
console.log($(this).attr('href'));
$('#blogs_data').attr('action', $(this).attr('href'));
$('#blogs_data').submit();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</td>
{% if request.user.is_superuser or request.user == category.user or request.user|get_user_role_name != 'Author' %}
<td class="actions">
<a href="{% url 'edit_category' category_slug=category.slug %}" class="edit"><i class="fa fa-edit"></i> Edit</a><a href="{% url 'delete_category' category_slug=category.slug %}" class="delete"><i class="fa fa-trash-o"></i> Delete</a>
<a href="{% url 'edit_category' category_slug=category.slug %}" class="edit"><i class="fa fa-edit"></i> Edit</a><a href="{% url 'delete_category' category_slug=category.slug %}" class="delete" data-confirm="true"><i class="fa fa-trash-o"></i> Delete</a>
</td>
{% endif %}
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
{% if request.user.is_superuser %}
<td class="actions">
<a href="{% url 'edit_menu' menu_list.id %}" class="edit"><i class="fa fa-edit"></i> Edit</a>
<a href="#" class="delete"><i class="fa fa-trash"></i> Delete</a>
<a href="#" class="delete" data-confirm="true"><i class="fa fa-trash"></i> Delete</a>
</td>
{% endif %}
</tr>
Expand Down Expand Up @@ -140,10 +140,10 @@ <h2 align="center">There are no menus here!</h2>
}, 'json');
})

$('.pagination li a').click(function(event){
event.preventDefault();
$('#menus_data').attr('action', $(this).attr('href'));
$('#menus_data').submit();
});
// $('.pagination li a').click(function(event){
// event.preventDefault();
// $('#menus_data').attr('action', $(this).attr('href'));
// $('#menus_data').submit();
// });
</script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@
placeholder: "Select an option"
}
);

{% block delete_confirmation %}
// for delete confirmation
$('*[data-confirm="true"]').on('click', function() {
return confirm("Are you sure?");
});
{% endblock delete_confirmation %}
// for pagination
$('.pagination li a.active').each(function(){
$(this).css('background', '#337AB7');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,51 @@
{% csrf_token %}
<div class="row form_row no_row_margin">
<div class="col-md-12">
{% for field in form %}
<div class="form-group">
<label>{{ field.label }} :</label>
<div class="controls">
{{ field }}
{% if field.help_text %}
<p class="help-inline"><small>{{ field.help_text }}</small></p>
<div class="col-md-6">
{% for field in form %}
{% if field.name != 'content' %}
{% if field.name == 'is_active' %}
<div class="form-group">
<label>{{ field.label }}</label>
<div class="controls">
<select class="form-control" id="id_is_active" name="is_active">
<option value="True" {% if field.value %}selected{% endif %} >Active</option>
<option value="False" {% if not field.value %}selected{% endif %}>Inactive</option>
</select>
{% if field.help_text %}
<p class="help-inline"><small>{{ field.help_text }}</small></p>
{% endif %}
</div>
</div>
{% else %}
<div class="form-group">
<label>{{ field.label }}</label>
<div class="controls">
{{ field }}
{% if field.help_text %}
<p class="help-inline"><small>{{ field.help_text }}</small></p>
{% endif %}
</div>
</div>
{% endif %}
</div>
</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
<div class="col-md-6">
{% for field in form %}
{% if field.name == 'content' %}
<div class="form-group">
<label>Description</label>
<div class="controls">
{{ field }}
{% if field.help_text %}
<p class="help-inline"><small>{{ field.help_text }}</small></p>
{% endif %}
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
<div class=" col-md-12 buttons_row text-left">
<div class="form-group">
Expand All @@ -46,7 +80,10 @@
{% block js_script %}
<script type="text/javascript">
CKEDITOR.config.allowedContent = true;
var editor = CKEDITOR.replace('content', {});
var editor = CKEDITOR.replace('content', {
uiColor: '#ffffff',
height:260,
});

$('#post-form').submit(function(event){
event.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<td class="actions">
<a href="{% url 'page_view' page_slug=page.slug %}" class="view"><i class="fa fa-eye"></i> View</a>
<a href="{% url 'edit_page' page_slug=page.slug %}" class="edit"><i class="fa fa-edit"></i> Edit</a>
<a href="{% url 'delete_page' page_slug=page.slug %}" class="delete"><i class="fa fa-trash-o"></i> Delete</a>
<a href="{% url 'delete_page' page_slug=page.slug %}" class="delete" data-confirm="true"><i class="fa fa-trash-o"></i> Delete</a>
</td>
{% endif %}
</tr>
Expand Down Expand Up @@ -130,10 +130,10 @@ <h2 align="center">There are no pages here!</h2>
}, 'json');
})

$('.pagination li a').click(function(event){
event.preventDefault();
$('#pages_data').attr('action', $(this).attr('href'));
$('#pages_data').submit();
});
// $('.pagination li a').click(function(event){
// event.preventDefault();
// $('#pages_data').attr('action', $(this).attr('href'));
// $('#pages_data').submit();
// });
</script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
{% csrf_token %}
<select class="form-control" name="bulk_actions_select" id='bulk_actions_select'>
<option>Choose An Action</option>
<option value="True">Enable</option>
<option value="False">Disable</option>
<option value="Delete">Delete</option>
</select>
Expand Down Expand Up @@ -77,7 +76,7 @@
</td>
{% if request.user.is_superuser or request.user|get_user_role_name != 'Author' %}
<td class="actions">
<a href="{% url 'edit_theme' theme.id %}" class="edit"><i class="fa fa-edit"></i> Edit</a><a href="{% url 'delete_theme' theme.id %}" class="delete"><i class="fa fa-trash-o"></i> Delete</a>
<a href="{% url 'edit_theme' theme.id %}" class="edit"><i class="fa fa-edit"></i> Edit</a><a href="{% url 'delete_theme' theme.id %}" class="delete" data-confirm="true"><i class="fa fa-trash-o"></i> Delete</a>
</td>
{% endif %}
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<td class="text-center post_count"><a href="#"><span data-toggle="tooltip" data-placement="bottom" title="Drafted">{{ user|user_drafted_posts }}</span> / <span data-toggle="tooltip" data-placement="bottom" title="Published">{{ user|user_published_posts }}</span></a></td>
<td class="actions">
<a href="{% url 'edit_user' user.id %}" class="edit"><i class="fa fa-edit"></i> Edit</a>
<a href="{% url 'delete_user' user.id %}" class="delete"><i class="fa fa-trash-o"></i> Delete</a>
<a href="{% url 'delete_user' user.id %}" class="delete" data-confirm="true"><i class="fa fa-trash-o"></i> Delete</a>
</td>
{% endif %}
</tr>
Expand Down Expand Up @@ -139,10 +139,10 @@ <h2 align="center">There are no users here!</h2>
}, 'json');
})

$('.pagination li a').click(function(event){
event.preventDefault();
$('#users_data').attr('action', $(this).attr('href'));
$('#users_data').submit();
});
// $('.pagination li a').click(function(event){
// event.preventDefault();
// $('#users_data').attr('action', $(this).attr('href'));
// $('#users_data').submit();
// });
</script>
{% endblock %}

0 comments on commit 76b6223

Please sign in to comment.