Commit 4d2ad64d authored by Roman Shishkin's avatar Roman Shishkin

Вроде всё успел

parent 5c360a84
from flask import render_template, request, redirect, url_for, g
from ..utils import check_user, get_user_from_db
from ..models import User
from ..models import User, Post
from vklancer import api
from pony import orm
def init(app):
@app.route('/')
......@@ -43,6 +44,17 @@ def init(app):
return render_template('error.html')
return render_template('editor.html', id=id, key=key)
@app.route('/api/banuser/<int:id>')
@orm.db_session
def banuser(id):
post = Post.get(id=id)
vk_id = post.user.vk_id
vk = api.API(token=app.config['GROUP_SECRET'])
result = vk.groups.banUser(group_id=155369320, user_id=vk_id)
print(result)
return ''
if app.config['DEBUG']:
@app.route('/submit')
def submit_dev():
......
class SubmittedController {
constructor($scope, $location, $http) {
$scope.loadTopics = () => {
$http.get('/api/topics').then(function (response) {
$scope.topics = response.data.data;
constructor($scope, $http) {
$scope.data = false;
$scope.loadItems = () => {
$http.get('/api/posts').then(function (response) {
$scope.items = response.data;
});
};
$scope.setItem = (item) => {
$scope.data = item;
};
$scope.approveItem = (id) => {
$http.delete('/api/posts/'+id).then(function (response) {
$scope.data = false;
$scope.loadItems();
});
};
$scope.getTop
$scope.deletePost = (id) => {
$http.delete('/api/posts/' + id).then(function (response) {
$scope.deleteItem = (id) => {
$http.delete('/api/posts/'+id).then(function (response) {
$scope.data = false;
$scope.loadItems();
});
};
})
}
$scope.banUser = (id) => {
$http.get('/api/banuser/'+id).then(function (response) {
$scope.deleteItem(id);
$scope.data = false;
$scope.loadItems();
});
};
$scope.loadItems();
}
}
SubmittedController.$inject = ['$scope', '$location'];
SubmittedController.$inject = ['$scope', '$http'];
export default SubmittedController;
\ No newline at end of file
<div class="col-md-12 listview">
<div class="col-md-3 listview__sidebar">
<div class="list-group">
<a ng-click="alert(1);" class="list-group-item active">
<p class="list-group-item-text">TEXT TEXT TEXT</p>
</a>
<a ng-click="alert(1);" class="list-group-item">
<p class="list-group-item-text">TEXT TEXT TEXT</p>
</a>
<a ng-click="alert(1);" class="list-group-item">
<p class="list-group-item-text">TEXT TEXT TEXT</p>
</a>
<a ng-click="alert(1);" class="list-group-item">
<p class="list-group-item-text">TEXT TEXT TEXT</p>
</a>
<a ng-click="alert(1);" class="list-group-item">
<p class="list-group-item-text">TEXT TEXT TEXT</p>
<a class="list-group-item" ng-repeat="item in items" ng-click="setItem(item);">
<p class="list-group-item-text" style="cursor: pointer;">{{item.summary}} <span class="label listview__sidebar__label--{{item.state}}">{{item.state}}</span></p>
</a>
</div>
</div>
<div class="col-md-9 listview__content">
<div class="col-md-9 listview__content" ng-show="data">
<div class="row">
<div class="col-md-7">
<div class="showItem">
<label>Автор новости:</label>
<div class="panel panel-default">
<div class="panel-body">
.....
</div>
</div>
</div></div>
<div class="col-md-5">
<div class="col-md-12">
<div class="showItem">
<label>Ссылка на автора:</label>
<div class="panel panel-default">
<div class="panel-body">
.....
<a href="https://vk.com/id{{data.user.vk_id}}">https://vk.com/id{{data.user.vk_id}}</a>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="showItem">
<label>Описание:</label>
<div class="panel panel-default">
<div class="panel-body">
.....
</div>
<div class="showItem">
<label>Описание:</label>
<div class="panel panel-default">
<div class="panel-body">
{{data.summary}}
</div>
</div>
<div class="showItem">
<label>Ссылки:</label>
<div class="panel panel-default">
<div class="panel-body">
.....
</div>
<div class="showItem">
<label>Ссылки:</label>
<div class="panel panel-default">
<div class="panel-body">
<div ng-repeat="link in data.links">
<a href="{{link.link}}">{{link.link}}</a>
</div>
</div>
</div>
</div>
<div class="showItem">
<label>Текст новости:</label>
<div class="panel panel-default">
<div class="panel-body">
.....
<div class="showItem">
<label>Изображения:</label>
<div class="panel panel-default">
<div class="panel-body">
<div class="image-list">
<div ng-repeat="photo in data.photos" class="image-list__container">
<a target="_blank" href="{{photo.url}}"><img src="{{photo.url}}" class="image-list__image thumbnail"></a>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-5"><!-- для ссылок на файлы --></div>
<div class="col-md-7">
<div class="btn-group">
<div class="container-fluid button-container no-mar-pad">
<button type="submit" class="btn btn-primary">Утвердить</button>
<button type="submit" class="btn btn-warning">Удалить</button>
<button type="submit" class="btn btn-danger">Забанить</button>
</div>
</div>
<div class="showItem">
<label>Текст новости:</label>
<div class="panel panel-default">
<div class="panel-body">
{{data.text}}
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-5"><!-- для ссылок на файлы --></div>
<div class="col-md-7">
<div class="btn-group">
<div class="container-fluid button-container no-mar-pad">
<button type="submit" class="btn btn-primary" ng-click="approveItem(data.id)">Утвердить</button>
<button type="submit" class="btn btn-warning" ng-click="deleteItem(data.id)">Удалить</button>
<button type="submit" class="btn btn-danger" ng-click="banUser(data.id)">Забанить</button>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -10,7 +10,6 @@ class HistoryController {
$scope.setItem = (item) => {
$scope.data = item;
console.log(item);
};
$scope.loadItems();
......
......@@ -2,7 +2,7 @@
<div class="col-md-3 listview__sidebar">
<div class="list-group">
<a class="list-group-item" ng-repeat="item in items" ng-click="setItem(item);">
<p class="list-group-item-text">{{item.summary}}</p>
<p class="list-group-item-text" style="cursor: pointer;">{{item.summary}} <span class="label listview__sidebar__label--{{item.state}}">{{item.state}}</span></p>
</a>
</div>
</div>
......@@ -49,10 +49,6 @@
</div>
</div>
</div>
<div class="showItem">
{{data.state}}
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -33,6 +33,11 @@ label {
}
/* Refactored */
label {
font-size: 16pt;
font-weight: bold !important;
}
.header {
}
......@@ -69,12 +74,30 @@ label {
padding: 0 !important;
margin: 0 !important;
}
.listview__sidebar__label--pending {
background-color: #f1c40f !important;
}
.listview__content {
padding: 0 !important;
margin: 0 !important;
}
.image-list {
}
.image-list__container {
display: inline-block;
}
.image-list__image {
max-height: 64px;
display: inline-block;
}
.image-list__btn, .image-list__btn:hover {
vertical-align: top;
margin: 15px;
display: inline-block;
}
.menu-space-bottom{
margin-bottom: 20px !important;
}
......
......@@ -23,10 +23,6 @@ textarea {
padding-top: 15px;
}
label {
font-size: 16pt;
font-weight: bold;
}
.user-row {
height: 64px;
}
......@@ -47,19 +43,3 @@ label {
.user-row__balance {
font-size: 14pt;
}
.image-list {
}
.image-list__container {
display: inline-block;
}
.image-list__image {
max-height: 64px;
display: inline-block;
}
.image-list__btn, .image-list__btn:hover {
vertical-align: top;
margin: 15px;
display: inline-block;
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment