Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin posting to front page #206

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cubingusa.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
webapp2.Route('/async/championship_psych/<championship_id:.*>/<event_id:.*>',
handler=ChampionshipPsychAsyncHandler),
# Admin
webapp2.Route('/admin/edit_announcements',
handler=BasicHandler('/admin/announcement.html',
permitted_roles=Roles.AllRoles()),
name='admin_edit_announcement'),
webapp2.Route('/admin/edit_users',
handler=BasicHandler('admin/edit_users.html',
permitted_roles=Roles.AllRoles()),
Expand Down
1 change: 1 addition & 0 deletions src/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def get_nav_items(self):
if self.user and self.user.HasAnyRole(Roles.AdminRoles()):
admin_list = [('Edit Users', '/admin/edit_users'),
('Edit Championships', '/admin/edit_championships'),
('Edit Announcements','/admin/edit_announcements')
]
items.append(('Admin', admin_list))
return items
Expand Down
44 changes: 44 additions & 0 deletions src/templates/admin/announcement.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{% import "components/css.html" as css %}
{% extends "base.html" %}
{% block title%}Public Documents{% endblock %}
{% block style %}
{{ css.css(c, 'base') }}
{% endblock %}
{% block content %}

<h1>CubingUSA Announcements</h1>

<div style="margin-top:30px;">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this kind of inline CSS okay, or should I make a separate style file for the announcements?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to not have inline styling. As the project grows it will only get harder to move the inline styling out into separate files.

<h3>Make A New Announcement</h3>
<form>
<div>

<div class="label-container">
<label for="title">Post title</label>
</div>
<div class="input-container">
<input type="text" class="form-control" name="title" placeholder="The one line that will be shown in the post feed" required>
</div>

<div class="form-group">
<label for="Post">Post Message</label>
<textarea placeholder="Body of the post (optional)"class="form-control" name="Post" rows="5"></textarea>
</div>

</div>

<button style="margin-bottom:30px;" class="button" type="submit">Post</button>

</form>

<h3>Current Announcements</h3>

<!-- Example posts for now -->
<ul class="list-group">
<li class="list-group-item">Posts will appear here <i class="fa fa-trash float-right"></i> <i class="fa fa-edit float-right"></i></li>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FA icons need some formatting, they're there just as placeholders

<li class="list-group-item">Examples to test the look <i class="fa fa-trash float-right"></i> <i class="fa fa-edit float-right"></i></li>
</ul>

</div>

{% endblock %}
14 changes: 12 additions & 2 deletions src/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,22 @@ <h4 class="card-title">CubingUSA Nationals</h4>
</div>
<div class="standard-block">
<div class="card">
<img class="card-img-top" src="/static/img/cubingUSA_4.svg" alt="Regional Championships">
<!-- <img class="card-img-top" src="/static/img/cubingUSA_4.svg" alt="Regional Championships">
<div class="card-body">
<h4 class="card-title">Regional Championships</h4>
<p class="card-text">Each year, we host seven Regional Championships across the country, allowing lots of different cubers a chance to compete for a title.</p>
<a href="{{ c.uri_for('competitions_regional') }}" class="button">Learn More</a>
</div>
</div> -->
<!-- <div class="card-header"><h4 class="card-title">Recent Posts</h4></div> -->

<ul class="list-group list-group-flush">
<li class="list-group-item active"><h3>Recent Posts</h3></li>
<li class="list-group-item">Test Posts <a href="cubingusa.org">Read More</a></li>
<li class="list-group-item">Will Appear Here <a href="cubingusa.org">Read More</a></li>
<li class="list-group-item">Regional Championships Announced! <a href="cubingusa.org">Read More</a></li>
<li class="list-group-item">Make sure to check out our new logo!</li>
</ul>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this look? I have it set up so it's different from the 'more links' card because it seems more important. I have the layout for making it a normal card header commented out for now. Do people want this to look different, or have it the same as the 'more links' style?

</div>
</div>
<div class="standard-block">
Expand Down