Commit a82865e34cf4a4381da498ec1f110d3c0562441d
1 parent
6a82a223
add Vitaliy's widgets
Showing
9 changed files
with
252 additions
and
5 deletions
Show diff stats
common/widgets/views/image_sizer.php
| @@ -57,17 +57,17 @@ $id = $model::tableName().'_id'; | @@ -57,17 +57,17 @@ $id = $model::tableName().'_id'; | ||
| 57 | var old_url = $('#<?=$field?>_old_img').val(); | 57 | var old_url = $('#<?=$field?>_old_img').val(); |
| 58 | var new_url = $('#<?=$field?>_new_img').val(); | 58 | var new_url = $('#<?=$field?>_new_img').val(); |
| 59 | var model = '<?=str_replace('\\', '-',$model::className());?>'; | 59 | var model = '<?=str_replace('\\', '-',$model::className());?>'; |
| 60 | - $.post( "/admin/site/delete-image",{new_url:new_url,old_img: old_url,model:model,field:"<?= $field?>", id:"<?=$model->$id?>",action:'save'}, function() { | 60 | + $.post( "/file/delete-image",{new_url:new_url,old_img: old_url,model:model,field:"<?= $field?>", id:"<?=$model->$id?>",action:'save'}, function() { |
| 61 | }); | 61 | }); |
| 62 | $("#<?=$field?>_picture_link").val(new_url); | 62 | $("#<?=$field?>_picture_link").val(new_url); |
| 63 | }); | 63 | }); |
| 64 | 64 | ||
| 65 | $('body').on('click', '#<?=$field?>_remove_img',function(){ | 65 | $('body').on('click', '#<?=$field?>_remove_img',function(){ |
| 66 | $("#<?=$field?>_buttons_block").remove(); | 66 | $("#<?=$field?>_buttons_block").remove(); |
| 67 | - $("#<?=$field?>_buttons_block").remove(); | 67 | + |
| 68 | var old_url = $('#<?=$field?>_old_img').val(); | 68 | var old_url = $('#<?=$field?>_old_img').val(); |
| 69 | var new_url = $('#<?=$field?>_new_img').val(); | 69 | var new_url = $('#<?=$field?>_new_img').val(); |
| 70 | - $.post( "/admin/site/delete-image",{old_img: new_url}, function() { | 70 | + $.post( "/file/delete-image",{old_img: new_url}, function() { |
| 71 | }); | 71 | }); |
| 72 | $("#<?=$field?>_picture_link").val(old_url); | 72 | $("#<?=$field?>_picture_link").val(old_url); |
| 73 | $('#<?= $field?>_img_block').find('img').attr('src',old_url); | 73 | $('#<?= $field?>_img_block').find('img').attr('src',old_url); |
| @@ -120,7 +120,7 @@ $id = $model::tableName().'_id'; | @@ -120,7 +120,7 @@ $id = $model::tableName().'_id'; | ||
| 120 | var gallery = $("#<?= $field?>_picture_link"); | 120 | var gallery = $("#<?= $field?>_picture_link"); |
| 121 | var urls = gallery.val(); | 121 | var urls = gallery.val(); |
| 122 | gallery.val(urls.replace(url+',', "")); | 122 | gallery.val(urls.replace(url+',', "")); |
| 123 | - $.post( "/admin/site/delete-image",{old_img: url}, function( data ) { | 123 | + $.post( "/file/delete-image",{old_img: url}, function( data ) { |
| 124 | $( ".result" ).html( data ); | 124 | $( ".result" ).html( data ); |
| 125 | }); | 125 | }); |
| 126 | }) | 126 | }) |
console/migrations/m160204_103008_add_payment_connections.php
| @@ -29,9 +29,10 @@ | @@ -29,9 +29,10 @@ | ||
| 29 | 29 | ||
| 30 | public function down () | 30 | public function down () |
| 31 | { | 31 | { |
| 32 | - $this->dropTable ('{{%payment}}'); | ||
| 33 | $this->dropTable('{{%user_specialization}}'); | 32 | $this->dropTable('{{%user_specialization}}'); |
| 34 | $this->dropTable('{{%user_payment}}'); | 33 | $this->dropTable('{{%user_payment}}'); |
| 34 | + $this->dropTable ('{{%payment}}'); | ||
| 35 | + | ||
| 35 | } | 36 | } |
| 36 | /* | 37 | /* |
| 37 | // Use safeUp/safeDown to run migration code within a transaction | 38 | // Use safeUp/safeDown to run migration code within a transaction |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160208_091942_vacancies extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up() | ||
| 8 | + { | ||
| 9 | + $tableOptions = null; | ||
| 10 | + | ||
| 11 | + $this->createTable('{{%vacancy}}', [ | ||
| 12 | + 'vacancy_id' => $this->primaryKey(), | ||
| 13 | + 'user_id' => $this->integer()->notNull(), | ||
| 14 | + 'name' => $this->string(255)->notNull(), | ||
| 15 | + 'link' => $this->string(255), | ||
| 16 | + 'date_add' => $this->timestamp(), | ||
| 17 | + 'user_add_id' => $this->integer(), | ||
| 18 | + 'view_count' => $this->integer(), | ||
| 19 | + 'user_name' => $this->string(255), | ||
| 20 | + 'city' => $this->string(255), | ||
| 21 | + 'description' => $this->text(), | ||
| 22 | + ], $tableOptions); | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public function down() | ||
| 27 | + { | ||
| 28 | + $this->dropTable('{{%vacancy}}'); | ||
| 29 | + } | ||
| 30 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160208_093153_project extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up() | ||
| 8 | + { | ||
| 9 | + $tableOptions = null; | ||
| 10 | + | ||
| 11 | + $this->createTable('{{%project}}', [ | ||
| 12 | + 'project_id' => $this->primaryKey(), | ||
| 13 | + 'user_id' => $this->integer()->notNull(), | ||
| 14 | + 'name' => $this->string(255)->notNull(), | ||
| 15 | + 'link' => $this->string(255), | ||
| 16 | + 'project_pid' => $this->integer(), | ||
| 17 | + 'date_add' => $this->timestamp()->notNull(), | ||
| 18 | + 'date_end' => $this->timestamp(), | ||
| 19 | + 'user_add_id' => $this->integer(), | ||
| 20 | + 'view_count' => $this->float(), | ||
| 21 | + 'budget' => $this->string(255), | ||
| 22 | + 'city' => $this->string(255), | ||
| 23 | + 'street' => $this->string(255), | ||
| 24 | + 'house' => $this->string(255), | ||
| 25 | + 'payment_variant' => $this->smallInteger()->defaultValue(1), | ||
| 26 | + 'deadline' => $this->integer(), | ||
| 27 | + 'description' => $this->text(), | ||
| 28 | + ], $tableOptions); | ||
| 29 | + | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public function down() | ||
| 33 | + { | ||
| 34 | + $this->dropTable('{{%project}}'); | ||
| 35 | + } | ||
| 36 | +} |
console/migrations/m160208_094102_add_project_specialization.php
0 โ 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160208_094102_add_project_specialization extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up () | ||
| 8 | + { | ||
| 9 | + $this->createTable ( | ||
| 10 | + '{{%project_specialization}}', [ | ||
| 11 | + 'project_specialization_id' => $this->primaryKey (), 'project_id' => $this->integer (), 'specialization_id' => $this->integer (), | ||
| 12 | + ] | ||
| 13 | + ); | ||
| 14 | + $this->addForeignKey ('project_specialization_index', '{{%project_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE'); | ||
| 15 | + $this->addForeignKey ('specialization_project_index', '{{%project_specialization}}', 'project_id', '{{%project}}', 'project_id', 'CASCADE', 'CASCADE'); | ||
| 16 | + | ||
| 17 | + $this->createTable ( | ||
| 18 | + '{{%project_payment}}', [ | ||
| 19 | + 'project_payment_id' => $this->primaryKey (), 'project_id' => $this->integer (), 'payment_id' => $this->integer (), | ||
| 20 | + ] | ||
| 21 | + ); | ||
| 22 | + $this->addForeignKey ('project_payment_index', '{{%project_payment}}', 'payment_id', '{{%payment}}', 'payment_id', 'CASCADE', 'CASCADE'); | ||
| 23 | + $this->addForeignKey ('payment_project_index', '{{%project_payment}}', 'project_id', '{{%project}}', 'project_id', 'CASCADE', 'CASCADE'); | ||
| 24 | + | ||
| 25 | + $this->createTable ( | ||
| 26 | + '{{%employment}}', [ | ||
| 27 | + 'employment_id' => $this->primaryKey (), 'name' => $this->integer (), | ||
| 28 | + ] | ||
| 29 | + ); | ||
| 30 | + $this->createTable ( | ||
| 31 | + '{{%vacancy_employment}}', [ | ||
| 32 | + 'vacancy_employment' => $this->primaryKey (), 'vacancy_id' => $this->integer (), 'employment_id' => $this->integer (), | ||
| 33 | + ] | ||
| 34 | + ); | ||
| 35 | + $this->addForeignKey ('vacancy_employment_index', '{{%vacancy_employment}}', 'employment_id', '{{%employment}}', 'employment_id', 'CASCADE', 'CASCADE'); | ||
| 36 | + $this->addForeignKey ('employment_vacancy_index', '{{%vacancy_employment}}', 'vacancy_id', '{{%vacancy}}', 'vacancy_id', 'CASCADE', 'CASCADE'); | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public function down () | ||
| 41 | + { | ||
| 42 | + $this->dropTable('{{%project_specialization}}'); | ||
| 43 | + $this->dropTable('{{%project_payment}}'); | ||
| 44 | + $this->dropTable('{{%vacancy_employment}}'); | ||
| 45 | + $this->dropTable('{{%employment}}'); | ||
| 46 | + | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160208_095412_portfolio extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up() | ||
| 8 | + { | ||
| 9 | + $tableOptions = null; | ||
| 10 | + | ||
| 11 | + $this->createTable('{{%portfolio}}', [ | ||
| 12 | + 'portfolio_id' => $this->primaryKey(), | ||
| 13 | + 'user_id' => $this->integer()->notNull(), | ||
| 14 | + 'name' => $this->string(255)->notNull(), | ||
| 15 | + 'link' => $this->string(255), | ||
| 16 | + 'date_add' => $this->timestamp()->notNull(), | ||
| 17 | + 'user_add_id' => $this->integer(), | ||
| 18 | + 'view_count' => $this->integer()->defaultValue(0), | ||
| 19 | + 'city' => $this->string(255), | ||
| 20 | + 'street' => $this->string(255), | ||
| 21 | + 'house' => $this->string(255), | ||
| 22 | + 'description' => $this->text(), | ||
| 23 | + 'cover' => $this->text(), | ||
| 24 | + 'gallery_id' => $this->integer(), | ||
| 25 | + ], $tableOptions); | ||
| 26 | + $this->createTable ( | ||
| 27 | + '{{%portfolio_specialization}}', [ | ||
| 28 | + 'portfolio_specialization_id' => $this->primaryKey (), 'portfolio_id' => $this->integer (), 'specialization_id' => $this->integer (), | ||
| 29 | + ] | ||
| 30 | + ); | ||
| 31 | + $this->addForeignKey ('portfolio_specialization_index', '{{%portfolio_specialization}}', 'specialization_id', '{{%specialization}}', 'specialization_id', 'CASCADE', 'CASCADE'); | ||
| 32 | + $this->addForeignKey ('specialization_portfolio_index', '{{%portfolio_specialization}}', 'portfolio_id', '{{%portfolio}}', 'portfolio_id', 'CASCADE', 'CASCADE'); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public function down() | ||
| 36 | + { | ||
| 37 | + | ||
| 38 | + $this->dropTable('{{%portfolio_specialization}}'); | ||
| 39 | + $this->dropTable('{{%portfolio}}'); | ||
| 40 | + } | ||
| 41 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160208_101449_team extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up() | ||
| 8 | + { | ||
| 9 | + $tableOptions = null; | ||
| 10 | + | ||
| 11 | + $this->createTable('{{%team}}', [ | ||
| 12 | + 'team_id' => $this->primaryKey(), | ||
| 13 | + 'user_id' => $this->integer()->notNull(), | ||
| 14 | + 'firstname' => $this->string(255)->notNull(), | ||
| 15 | + 'lastname' => $this->string(255)->notNull(), | ||
| 16 | + 'midlename' => $this->string(255), | ||
| 17 | + 'link' => $this->string(255), | ||
| 18 | + 'position' => $this->string(255)->notNull(), | ||
| 19 | + 'department_id' => $this->integer()->notNull(), | ||
| 20 | + 'experience_from' => $this->timestamp(), | ||
| 21 | + 'date_add' => $this->timestamp()->notNull(), | ||
| 22 | + 'user_add_id' => $this->integer(), | ||
| 23 | + 'photo' => $this->string(255), | ||
| 24 | + 'country_id' => $this->string(255)->notNull(), | ||
| 25 | + ], $tableOptions); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public function down() | ||
| 29 | + { | ||
| 30 | + $this->dropTable('{{%team}}'); | ||
| 31 | + } | ||
| 32 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160208_111900_blog extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up() | ||
| 8 | + { | ||
| 9 | + $tableOptions = null; | ||
| 10 | + | ||
| 11 | + $this->createTable('{{%blog}}', [ | ||
| 12 | + 'blog_id' => $this->primaryKey(), | ||
| 13 | + 'user_id' => $this->integer()->notNull(), | ||
| 14 | + 'name' => $this->string(255)->notNull(), | ||
| 15 | + 'link' => $this->string(255), | ||
| 16 | + 'date_add' => $this->timestamp()->notNull(), | ||
| 17 | + 'user_add_id' => $this->integer(), | ||
| 18 | + 'view_count' => $this->integer()->defaultValue(0), | ||
| 19 | + 'description' => $this->text(), | ||
| 20 | + 'cover' => $this->string(255), | ||
| 21 | + ], $tableOptions); | ||
| 22 | + | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public function down() | ||
| 26 | + { | ||
| 27 | + $this->dropTable('{{%blog}}'); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +class m160208_112838_gallery extends Migration | ||
| 6 | +{ | ||
| 7 | + public function up() | ||
| 8 | + { | ||
| 9 | + $tableOptions = null; | ||
| 10 | + | ||
| 11 | + $this->createTable('{{%gallery}}', [ | ||
| 12 | + 'gallery_id' => $this->primaryKey(), | ||
| 13 | + 'user_id' => $this->integer()->notNull(), | ||
| 14 | + 'name' => $this->string(255)->notNull(), | ||
| 15 | + 'date_add' => $this->timestamp()->notNull(), | ||
| 16 | + 'user_add_id' => $this->integer(), | ||
| 17 | + 'cover' => $this->string(255), | ||
| 18 | + 'type' => $this->smallInteger(), | ||
| 19 | + 'photo' => $this->text(), | ||
| 20 | + ], $tableOptions); | ||
| 21 | + | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public function down() | ||
| 25 | + { | ||
| 26 | + $this->dropTable('{{%gallery}}'); | ||
| 27 | + } | ||
| 28 | +} |