Commit 11502c71 authored by Andrey Zavodov's avatar Andrey Zavodov

Merge remote-tracking branch 'origin/develop' into develop

parents 32347c48 d6d692c4
class CreateController {
constructor($scope, $location) {
$scope.isRouteActive = function(route) {
let curRoute = $location.path();
return curRoute.match(route);
}
constructor($scope, $location, $http) {
$scope.link = ["", "", "", "", ""];
$scope.contents = [];
let number = 1;
let max = 4;
let value = "Дополнительное поле для ссылки";
$scope.show = (id) => {
if (number <= max && $scope.link[number - 1].length === 1) {
$scope.contents.push({number: number, name: "link" + number, value: value});
number++;
}
if ($scope.link[id].length === 0 && id > 0 && (id === $scope.contents.length - 1) && ($scope.link[id + 1].length === 0)) {
$scope.contents.pop();
number--;
}
};
}
}
CreateController.$inject = ['$scope', '$location'];
CreateController.$inject = ['$scope', '$location', '$http'];
export default CreateController;
\ No newline at end of file
<div class="col-md-12">
<header class="header">
<img class="header__image" src="/static/images/true_logo.png" alt="ЛЕНТАЧ">
<img class="header__image" src="/static/images/true_logo.png" alt="ЛЕНТАЧ">
</header>
<form class="user form">
<form>
<div class="input-group">
<label for="description">
......@@ -13,13 +13,17 @@
</div>
<div class="input-group">
<label for="source">
<label for="link0">
Ссылки:
</label>
<input type="text" id="source" class="form-control" placeholder="Ссылки на источники или издания">
<input type="text" ng-model="link[0]" ng-change="show(0)" name="link0" id="link0" class="form-control" placeholder="Ссылки на источники, издания или ресурсы">
<div ng-repeat="content in contents">
<input type="text" ng-model="link[content.number]" ng-change="show(content.number)" class="form-control" name="{{content.name}}" placeholder="{{content.value}}"/>
</div>
</div>
<div class="input-group create-input-group">
<div class="input-group">
<label for="text">
Текст новости:
</label>
......@@ -31,7 +35,7 @@
var observe;
if (window.attachEvent) {
observe = function (element, event, handler) {
element.attachEvent('on'+event, handler);
element.attachEvent('on' + event, handler);
};
}
else {
......@@ -39,20 +43,24 @@
element.addEventListener(event, handler, false);
};
}
function init () {
function init() {
var text = document.getElementById('text');
function resize () {
function resize() {
text.style.height = 'auto';
text.style.height = text.scrollHeight+'px';
text.style.height = text.scrollHeight + 'px';
}
/* 0-timeout to get the already changed text */
function delayedResize () {
function delayedResize() {
window.setTimeout(resize, 0);
}
observe(text, 'change', resize);
observe(text, 'cut', delayedResize);
observe(text, 'paste', delayedResize);
observe(text, 'drop', delayedResize);
observe(text, 'change', resize);
observe(text, 'cut', delayedResize);
observe(text, 'paste', delayedResize);
observe(text, 'drop', delayedResize);
observe(text, 'keydown', delayedResize);
text.focus();
......
......@@ -70,11 +70,6 @@ label {
margin: 0 !important;
}
.listview__sidebar .list-group-item {
border-top-right-radius: 0 !important;
border-top-left-radius: 0 !important;
}
.listview__content {
padding: 0 !important;
margin: 0 !important;
......@@ -82,4 +77,8 @@ label {
.menu-space-bottom{
margin-bottom: 20px !important;
}
.input-group .form-control {
border-radius: 4px !important;
}
\ No newline at end of file
......@@ -26,6 +26,5 @@ angular.module('echoes')
});
}])
.controller('SubmitController', SubmitController)
.controller('CreateController', CreateController)
.controller('HistoryController', HistoryController);
\ 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