issue #1 reset form resets selected icon to empty

This commit is contained in:
kplaczek
2018-04-04 19:44:11 +02:00
commit bcc445f75a
196 changed files with 49208 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
Vue.component('example', require('./components/Example.vue'));
const app = new Vue({
el: '#app'
});

46
resources/assets/js/bootstrap.js vendored Normal file
View File

@@ -0,0 +1,46 @@
window._ = require('lodash');
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
window.$ = window.jQuery = require('jquery');
require('bootstrap-sass');
/**
* Vue is a modern JavaScript library for building interactive web interfaces
* using reactive data binding and reusable components. Vue's API is clean
* and simple, leaving you to focus on building your next great project.
*/
window.Vue = require('vue');
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common = {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest'
};
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from "laravel-echo"
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: 'your-pusher-key'
// });

View File

@@ -0,0 +1,23 @@
<template>
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Example Component</div>
<div class="panel-body">
I'm an example component!
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>

38
resources/assets/sass/_variables.scss vendored Normal file
View File

@@ -0,0 +1,38 @@
// Body
$body-bg: #f5f8fa;
// Borders
$laravel-border-color: darken($body-bg, 10%);
$list-group-border: $laravel-border-color;
$navbar-default-border: $laravel-border-color;
$panel-default-border: $laravel-border-color;
$panel-inner-border: $laravel-border-color;
// Brands
$brand-primary: #3097D1;
$brand-info: #8eb4cb;
$brand-success: #2ab27b;
$brand-warning: #cbb956;
$brand-danger: #bf5329;
// Typography
$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
$font-family-sans-serif: "Raleway", sans-serif;
$font-size-base: 14px;
$line-height-base: 1.6;
$text-color: #636b6f;
// Navbar
$navbar-default-bg: #fff;
// Buttons
$btn-default-color: $text-color;
// Inputs
$input-border: lighten($text-color, 40%);
$input-border-focus: lighten($brand-primary, 25%);
$input-color-placeholder: lighten($text-color, 30%);
// Panels
$panel-default-heading-bg: #fff;

9
resources/assets/sass/app.scss vendored Normal file
View File

@@ -0,0 +1,9 @@
// Fonts
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);
// Variables
@import "variables";
// Bootstrap
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

View File

@@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];

View File

@@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
];

View File

@@ -0,0 +1,22 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'password' => 'Passwords must be at least six characters and match the confirmation.',
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
];

View File

@@ -0,0 +1,119 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field is required.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => [],
];

View File

@@ -0,0 +1,13 @@
@extends('layouts.base')
@section('content')
<div class="ui container">
<div class="ui one column middle aligned stackable grid">
<div class="ui column">
<h2><a href="/">Lista</a> &raquo; Nowa notatka</h2>
</div>
</div>
</div>
@include('form.create')
@endsection

View File

@@ -0,0 +1,22 @@
@extends('layouts.base')
@section('content')
<style>
body .column .ui.form textarea:not([rows]) {max-height: inherit; height: 20em}
</style>
<div class="ui container">
<div class="ui one column middle aligned stackable grid">
<div class="ui column">
@if($type == 'template')
<h2><a href="/">Lista</a> &raquo; Edycja szablonu</h2>
@else
<h2><a href="/">Lista</a> &raquo; Edycja notatki</h2>
@endif
@include('form.create')
<br><br>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,49 @@
<form method="POST" class="ui form">
{{ csrf_field() }}
<div class="field">
<label>Tytuł</label>
<input type="text" name="title" value="{{ $title }}">
</div>
<div class="field">
<label>Treść</label>
<textarea class="js-content content"
name="text">{{ $text }}</textarea>
<input type="hidden" name="icon" id="icon" value="{{ $icon_selected }}"/>
<div class="icons">
<span class="icon @if(!isset($icon_selected) ) selected @endif empty" title="empty"></span>
@foreach ($icons as $icon)<span
class="icon {{ str_before($icon, '.') }} @if(isset($icon_selected) && $icon == basename($icon_selected)) selected @endif " title="{{ $icon }}">
</span>@endforeach
</div>
</div>
@if(isset($type) && $type == 'template')
<button class="ui submit button yellow" type="submit" name="save">Zapisz jako notatkę</button>
<button class="ui submit button orange" type="submit" name="save_template">Zapisz szablon</button>
@else
<button class="ui submit button yellow" type="submit" name="save">Zapisz</button>
<button class="ui submit button orange" type="submit" name="save_template">Zapisz jako szablon</button>
@endif
<button class="ui submit button primary" type="submit" name="print">Drukuj</button>
<button class="ui reset button js-reset" type="reset">Wyczyść</button>
@if(isset($id))
<button class="ui delete button js-delete red" type="submit" name="delete">Usuń</button>
@endif
</form>

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Paper Pi</title>
<link rel="stylesheet" type="text/css" class="ui" href="/css/semantic.min.css">
<link rel="stylesheet" type="text/css" class="ui" href="/css/app.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js"></script>
<script src="/js/semantic.min.js"></script>
<script src="/js/printer.js"></script>
</head>
<body>
<div class="">
@yield('content')
</div>
<script>
window.onload = load;
function load() {
var printer = new Printer();
printer.init();
$('.ui.dropdown').dropdown();
$('.ui.file.input').find('input:not(.url):text, .ui.button.trigger')
.on('click', function (e) {
$(e.target).parent().find('input:file').click();
})
;
$('input:file', '.ui.file.input')
.on('change', function (e) {
var file = $(e.target);
var name = '';
for (var i = 0; i < e.target.files.length; i++) {
name += e.target.files[i].name + ', ';
}
// remove trailing ","
name = name.replace(/,\s*$/, '');
$('input:text', file.parent()).val(name);
});
}
</script>
</body>
</html>

View File

@@ -0,0 +1,104 @@
@extends('layouts.base')
@section('content')
<div class="ui container">
<h1 class="ui header">Szybka notatka</h1>
<div class="ui container">
<div class="ui one column middle aligned stackable grid">
<div class="ui column">
@include('form.create')
<form method="POST" class="ui form" action="/printImage" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="field">
<label for="photo">Plik do wydrukowania:</label>
<div class="ui fluid file input action">
<input type="text" class="url" name="url"
placeholder="Wklej link do zdjęcia, albo wybierz plik z dysku obok">
<input type="text" readonly>
<input type="file" id="photo" name="photo" autocomplete="off"
accept=".jpg,.png,.gif,.jpeg,.bmp">
<div class="ui button trigger">
Wybierz plik...
</div>
<button class="ui submit button primary" type="submit" name="print-image">Drukuj
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="ui container">
<h1 class="ui header">Lista notatek</h1>
<div class="ui middle aligned divided list">
@foreach($notes as $note)
<div class="item">
<div class="right floated content">
<form method="post" action="/print/{{ $note->id }}">
{{ csrf_field() }}
<button type="primary" class="ui tiny button primary">Drukuj</button>
</form>
</div>
<div class="content">
<a href="/edit/{{ $note->id }}/{{ $note->topic_slug?$note->topic_slug:str_limit($note->text, 30, '...') }}"><span
class="icon {{ $note->icon }} "
title="{{ $note->icon }}"></span>{{ $note->topic?$note->topic:str_limit($note->text, 30, '...') }}
</a>
</div>
</div>
@endforeach
</div>
<h1 class="ui header">Szablony notatek</h1>
<div class="ui middle aligned divided list">
@foreach($templates as $template)
<div class="item">
<div class="content">
<a href="/edit/{{ $template->id }}/{{ $template->topic_slug?$template->topic_slug:str_limit($template->text, 30, '...') }}"><span
class="icon {{ $template->icon }} "
title="{{ $template->icon }}"></span> {{ $template->topic?$template->topic:str_limit($template->text, 30, '...') }}
</a>
</div>
</div>
@endforeach
</div>
<div class="ui teal tiny buttons">
<a class="ui button" href="/repertoire/today">Repertuar dziś</a>
<div class="ui floating dropdown icon button">
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="/multikino/today">Multikino</a>
<a class="item" href="/gdynskiecentrumfilmowe/today">Gdyńskie Centrum Filmowe</a>
<a class="item" href="/cinemacity/today">Cinema City</a>
<a class="item" href="/helios/today">Helios</a>
</div>
</div>
</div>
<div class="ui teal tiny buttons pointing top left">
<a class="ui button" href="/repertoire/tomorrow">Repertuar jutro</a>
<div class="ui floating dropdown icon button">
<i class="dropdown icon"></i>
<div class="menu">
<a class="item" href="/multikino/tomorrow">Multikino</a>
<a class="item" href="/gdynskiecentrumfilmowe/tomorrow">Gdyńskie Centrum Filmowe</a>
<a class="item" href="/cinemacity/tomorrow">Cinema City</a>
<a class="item" href="/helios/tomorrow">Helios</a>
</div>
</div>
</div>
<div class="ui teal tiny buttons pointing top left">
<a class="ui button" href="/airly">Airly</a>
</div>
</div>
@endsection

View File

@@ -0,0 +1,19 @@
@extends('layouts.base')
@section('content')
<style>
body .column .ui.form textarea:not([rows]) {max-height: inherit; height: 20em}
</style>
<div class="ui container">
<div class="ui one column middle aligned stackable grid">
<div class="ui column">
<h2><a href="/">Lista</a> &raquo; Edycja notatki</h2>
@include('form.create')
<br><br>
</div>
</div>
</div>
@endsection