Skip to content

Commit 47368a1

Browse files
authored
Merge pull request #98 from systeminc/development
Development
2 parents 6a730bc + 8dce0c5 commit 47368a1

File tree

6 files changed

+79
-5
lines changed

6 files changed

+79
-5
lines changed

src/Product.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class Product extends Model
3030
'visible',
3131
'featured',
3232
'stock',
33+
'seo_title',
34+
'seo_description',
35+
'seo_keywords',
3336
];
3437

3538
public function category()
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
6+
class AddSeoToProductTable extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
Schema::table('products', function (Blueprint $table) {
16+
$table->string('seo_title');
17+
$table->string('seo_description');
18+
$table->string('seo_keywords');
19+
});
20+
}
21+
22+
/**
23+
* Reverse the migrations.
24+
*
25+
* @return void
26+
*/
27+
public function down()
28+
{
29+
Schema::table('products', function (Blueprint $table) {
30+
$table->dropColumn('seo_title');
31+
$table->dropColumn('seo_description');
32+
$table->dropColumn('seo_keywords');
33+
});
34+
}
35+
}

src/resources/views/products/gallery.blade.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
</div>
55
<br><br>
66

7-
<form style="max-width: 100%;" action="galleries/update/{{ $product->gallery->title }}" class="images" method="post" enctype="multipart/form-data">
7+
<form style="max-width: 100%;" action="galleries/update/{{ $product->gallery->id }}" class="images" method="post" enctype="multipart/form-data">
88
{{ csrf_field() }}
99
<label for="title">Title:</label>
10-
<input type="text" name="title" value="{{ $product->gallery->title }}">
10+
<input type="text" name="title" value="{{ $product->title or $product->gallery->title }}">
1111

1212
@if( count($product->gallery->images) )
1313
<div class="gallery-wrap">
@@ -17,7 +17,9 @@
1717
<div class="buttons">
1818
<div onclick="ajaxDeleteGalleryImage('ajax/{{ $product->gallery->title }}/delete-gallery-images/{{ $image->id }}', '{{$image->id}}')" class="button remove-image delete">Delete</div>
1919
</div>
20-
<img src="uploads/{{$image->source}}" />
20+
<a href="galleries/image/{{ $product->gallery->id }}/{{ $image->id }}">
21+
<img src="uploads/{{$image->source}}" />
22+
</a>
2123
</li>
2224
@endforeach
2325
</ul>

src/resources/views/products/product.blade.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@
104104

105105
<label>Stock</label>
106106
<input type="text" name="stock" value="{{old('stock') ?: $product->stock}}">
107+
108+
<label>Seo title</label>
109+
<input type="text" name="seo_title" value="{{old('seo_title') ?: $product->seo_title}}">
110+
111+
<label>Seo description</label>
112+
<input type="text" name="seo_description" value="{{old('seo_description') ?: $product->seo_description}}">
113+
114+
<label>Seo keywords</label>
115+
<input type="text" name="seo_keywords" value="{{old('seo_keywords') ?: $product->seo_keywords}}">
107116

108117
<div class="cf">
109118
<label>Menu Order</label>

src/resources/views/tiny-images.blade.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
});
2020
2121
$(".thumb img").click(function(event) {
22+
$('form').before('<p class="message">Image added</p>');
23+
24+
setTimeout(function() {
25+
$('.message').fadeOut();
26+
}, 1000);
27+
28+
$(this).fadeOut('fast').fadeIn('fast');
29+
2230
window.parent.tinyMCE.get("{{$editor_id}}").execCommand('mceInsertContent',false,'<img style="position: relative; float: left;" src="'+$(this).attr("src")+'">');
2331
});
2432
@@ -41,6 +49,10 @@
4149

4250
<style>
4351
52+
.close:hover{
53+
color: red;
54+
}
55+
4456
.close{
4557
display: block;
4658
text-align: right;
@@ -50,6 +62,19 @@
5062
font-size: 16px;
5163
}
5264
65+
.message {
66+
padding: 15px;
67+
border: 1px solid transparent;
68+
border-radius: 4px;
69+
color: #3c763d;
70+
background-color: #dff0d8;
71+
border-color: #d6e9c6;
72+
width: 60%;
73+
text-align: center;
74+
display: block;
75+
margin: auto;
76+
}
77+
5378
form {
5479
display: inline-block;
5580
background: white;
@@ -104,7 +129,7 @@
104129
<div style="max-width: 500px; min-width:500px; overflow-y:auto; height:300px;">
105130

106131
@foreach ($images as $image)
107-
<div href="" class="thumb">
132+
<div class="thumb">
108133
<div class="delete-image" data-path='{{$image}}'>x</div>
109134
<img src="../{{ config('laravel-admin.route_prefix') }}/uploads/{{$image}}">
110135
</div>

tests/unit/ModelsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function testFillablefieldsProductModel()
151151
{
152152
$product = new Product();
153153

154-
$this->assertArraySubset(['product_category_id', 'brand_id', 'title', 'slug', 'excerpt', 'description', 'long_description', 'thumb', 'animation', 'video', 'pdf', 'gallery_id', 'price', 'shipment_price', 'menu_order', 'visible', 'featured', 'stock'], $product->getFillable());
154+
$this->assertArraySubset(['product_category_id', 'brand_id', 'title', 'slug', 'excerpt', 'description', 'long_description', 'thumb', 'animation', 'video', 'pdf', 'gallery_id', 'price', 'shipment_price', 'menu_order', 'visible', 'featured', 'stock', 'seo_title', 'seo_description', 'seo_keywords'], $product->getFillable());
155155
}
156156

157157
public function testFillablefieldsProductCategoryModel()

0 commit comments

Comments
 (0)