Browse Source

Revert "Merge branch 'redesign2' of http://dev.prmsys.net:3001/Rimmon/HyperCube into redesign2"

This reverts commit 19843849c7681a70e9692fe143b7bbc03cf8de3f, reversing
changes made to 371cd9589d170fae4ab69eee2f51f454978fd2fe.
Rimmon 3 years ago
parent
commit
4ab841f870
4 changed files with 91 additions and 73 deletions
  1. 17 17
      Pages/Desktop.razor
  2. 61 47
      Pages/Desktop.razor.cs
  3. 2 2
      Pages/DocEdit.razor.cs
  4. 11 7
      wwwroot/css/style.css

+ 17 - 17
Pages/Desktop.razor

@@ -93,6 +93,17 @@
                         <option selected value="hackathon22_01">Хакатон 2022</option>
                     </select>
                 </label>
+                <div class="second-block__input__file__label__box">
+                    <InputFile class="second-block__input__file" id="input_file" OnChange="@HandleUpload"
+                               accept="application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document,
+                                    text/html, text/plain, application/rtf" />
+                    <label for="input_file" class="second-block__input__file__label" id="file_label">
+                        <span>+</span>
+                        <p>Прикрепить файл</p>
+                    </label>
+                    @*@_article.Filename*@
+                </div>
+                <div class="upload__input-descr">Status: @_status</div>
                 <label class="upload__label">
                     <InputText type="text" placeholder="Наименование статьи" class="form-control upload__input" @bind-Value="_article.Name" />
                 </label>
@@ -111,17 +122,7 @@
                 </label>
                 <label class="upload__label">
                     <InputText type="text" placeholder="Ключевые слова" class="form-control upload__input" @bind-Value="_article.Keywords" />
-                    <div class="upload__input-descr">Status: @_status</div>
                 </label>
-                <div class="second-block__input__file__label__box">
-                    <InputFile class="second-block__input__file" id="input_file" OnChange="@HandleUpload"
-                               accept="application/pdf, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document,
-                                    text/html, text/plain, application/rtf" />
-                    <label for="input_file" class="second-block__input__file__label" id="file_label">
-                        <span>+</span>
-                        <p>Прикрепить файл</p>
-                    </label>
-                </div>
                 <div class="second-block__form__button">
                     <button class="btn_grey" @onclick="SendToVerify_OnClick">Отправить на верификацию</button>
                     <button class="btn_grey" @onclick="(() => SaveDocument_OnClick(Models.ArticleStatus.Saved))">Сохранить</button>
@@ -145,28 +146,27 @@
                     }
                 </select>
             </label>
-            <input type="checkbox" class="checkbox__input" name="verify" id="radio">
+            <input type="checkbox" class="checkbox__input" id="radio" @bind="@_verificationPoint.RulesViolation">
             <label class="сheckbox__label" for="radio">
                 Материал сформирован не по правилам
             </label>
-            <input type="checkbox" class="checkbox__input" name="verify" id="radio2">
+            <input type="checkbox" class="checkbox__input" id="radio2" @bind="@_verificationPoint.NonExpert">
             <label class="сheckbox__label" for="radio2">
                 Не являюсь экспертом в этой теме
             </label>
-            <input type="checkbox" class="checkbox__input" name="verify" id="radio3">
+            <input type="checkbox" class="checkbox__input" id="radio3" @bind="@_verificationPoint.AdditionalVerificationRequired">
             <label class="сheckbox__label" for="radio3">
                 Требуется дополнительная экспертиза
             </label>
-            <input type="checkbox" class="checkbox__input" name="verify" id="radio5">
+            <input type="checkbox" class="checkbox__input" id="radio5" @bind="@_verificationPoint.Rejected">
             <label class="сheckbox__label" for="radio5">
                 Отклонить, указать причину
             </label>
             <label class="upload__label">
-                <textarea placeholder="Причина" class="form-control upload__textarea"></textarea>
+                <textarea placeholder="Причина" class="form-control upload__textarea" @bind="@_verificationPoint.RejectReason" disabled=@(!_verificationPoint.Rejected)></textarea>
             </label>
             <label class="upload__label">
-                <textarea placeholder="Теги" class="form-control upload__textarea"></textarea>
-                <div class="upload__input-descr">+ Добавить тэг. Указывать тэги через запятую</div>
+                <textarea placeholder="Теги" class="form-control upload__textarea" @bind="@_verificationPoint.Tags"></textarea>
             </label>
             <div class="second-block__form__button">
                 <button class="btn_grey" @onclick="Verify_OnClick">Валидация</button>

+ 61 - 47
Pages/Desktop.razor.cs

@@ -74,58 +74,19 @@ namespace HyperCube.Pages
         bool loadButtonDisable { get; set; }
         bool verifyButtonDisable { get; set; }
 
+        bool rejectReasonDisable { get; set; }
+
         protected override async Task OnInitializedAsync()
         {
-            ///tmp
-            await AppData.LoadArticles();
-
-            _article = AppData.CurrentArticle ?? (new());
-            _articleClone = AppData.CurrentArticleClone ?? (new());
-            
             _currentAccount = (AppData.CurrentAccount != null) ? AppData.CurrentAccount : await GetCurrentAcc();
             _currentAccount.LoadRoles();
             Console.WriteLine($"Desktop OnInitializedAsync, CurrentAccount: {_currentAccount.Name}");
 
-            if (_currentAccount.Roles.Contains(Role.Admin))
-            {
-                loadButtonDisable = false;
-                verifyButtonDisable = false;
-
-                _articles = AppData.Articles;
-            }
-            else if (_currentAccount.Roles.Contains(Role.Expert))
-            {
-                loadButtonDisable = true;
-                verifyButtonDisable = false;
-
-                foreach (ArticleModel article in AppData.Articles.Values)
-                {
-                    if (article.Status == ArticleStatus.AwatingVerify || article.Status == ArticleStatus.Verifying)
-                        _articles.Add(article.ID, article);                    
-                }                
-
-                SwitchDesktopTab(1);
-            }
-            else if (_currentAccount.Roles.Contains(Role.Miner))
-            {
-                loadButtonDisable = false;
-                verifyButtonDisable = true;
-
-                foreach (ArticleModel article in AppData.Articles.Values)
-                {
-                    if (article.Status == ArticleStatus.New || article.Status == ArticleStatus.Saved)
-                        _articles.Add(article.ID, article);
-                }
-            }
-            else
-            {
-                loadButtonDisable = true;
-                verifyButtonDisable = true;
-
-                _articles = AppData.Articles;
+            ///tmp
+            await LoadArticles();
 
-                SwitchDesktopTab(2);
-            }
+            _article = AppData.CurrentArticle ?? (new());
+            _articleClone = AppData.CurrentArticleClone ?? (new());
         }
 
         protected override void OnAfterRender(bool firstRender) => _counter = 1;
@@ -450,7 +411,7 @@ namespace HyperCube.Pages
                     _articleClone = (ArticleModel)_article.Clone();
 
                     /// reloading articles
-                    await AppData.LoadArticles();
+                    await LoadArticles();
 
                     _counter = 1;
 
@@ -617,7 +578,7 @@ namespace HyperCube.Pages
             _articleClone = (ArticleModel)_article.Clone();
 
             /// reloading articles            
-            await AppData.LoadArticles();
+            await LoadArticles();
 
             _modalLoading.Close();
 
@@ -673,6 +634,59 @@ namespace HyperCube.Pages
             }
         }
 
+        void Rejected_OnChange()
+        {
+            rejectReasonDisable = !_verificationPoint.Rejected;
+        }
+
+        async Task LoadArticles()
+        {
+            /// reloading articles            
+            await AppData.LoadArticles();
+
+            ///updating local articles and UI on role claims
+            if (_currentAccount.Roles.Contains(Role.Admin))
+            {
+                loadButtonDisable = false;
+                verifyButtonDisable = false;
+
+                _articles = AppData.Articles;
+            }
+            else if (_currentAccount.Roles.Contains(Role.Expert))
+            {
+                loadButtonDisable = true;
+                verifyButtonDisable = false;
+
+                foreach (ArticleModel article in AppData.Articles.Values)
+                {
+                    if (article.Status == ArticleStatus.AwatingVerify || article.Status == ArticleStatus.Verifying)
+                        _articles.Add(article.ID, article);
+                }
+
+                SwitchDesktopTab(1);
+            }
+            else if (_currentAccount.Roles.Contains(Role.Miner))
+            {
+                loadButtonDisable = false;
+                verifyButtonDisable = true;
+
+                foreach (ArticleModel article in AppData.Articles.Values)
+                {
+                    if (article.Status == ArticleStatus.New || article.Status == ArticleStatus.Saved)
+                        _articles.Add(article.ID, article);
+                }
+            }
+            else
+            {
+                loadButtonDisable = true;
+                verifyButtonDisable = true;
+
+                _articles = AppData.Articles;
+
+                SwitchDesktopTab(2);
+            }
+        }
+
         async Task<string> CalculateHashSum(MemoryStream ms)
         {
             MD5CryptoServiceProvider md5Provider = new();

+ 2 - 2
Pages/DocEdit.razor.cs

@@ -160,9 +160,9 @@ namespace HyperCube.Pages
 
             if (DocID > 0)
             {
-                //status = propDict.Count > 0 ? "All changes saved, article has veryfied." : "Article verifyed without any changes.";
+                status = propDict.Count > 0 ? "All changes saved, article has veryfied." : "Article verifyed without any changes.";
                 //transactionId = await Verify();
-                //Console.WriteLine("transactionId found " + transactionId);
+                Console.WriteLine("transactionId found " + transactionId);
 
                 ///tmp
                 editsCount = await article.GetEditsCount(currentAcc.UUID);

+ 11 - 7
wwwroot/css/style.css

@@ -472,7 +472,7 @@ footer {
     color: #647B99;
     font-style: italic;
     font-family: 'Bahn', sans-serif; }
-  .upload__input::-ms-input-placeholder, .upload__textarea::-ms-input-placeholder {
+  .upload__input:-ms-input-placeholder, .upload__textarea:-ms-input-placeholder {
     color: #647B99;
     font-style: italic;
     font-family: 'Bahn', sans-serif; }
@@ -485,14 +485,18 @@ footer {
     font-style: italic;
     font-size: 14px;
     font-family: "Bahn"; }
+.upload__textarea:disabled, .upload__textarea[disabled] {
+    background-color:lightcoral;
+}
 
 .form-control:focus {
-  color: #495057;
-  background-color: #fff;
-  border-color: #80bdff;
-  outline: 0;
-  -webkit-box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
-  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25); }
+    color: #495057;
+    background-color: #fff;
+    border-color: #80bdff;
+    outline: 0;
+    -webkit-box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
+    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
+}
 
 #file_name {
   position: relative;